This is my resize program. Maybe it will be usefull to someone.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ExtCtrls, ComCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Image: TImage;
Bckg: TPaintBox;
TB: TTrackBar;
procedure FormCreate(Sender: TObject);
procedure TBChange(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
i, r: TRect;
x, y, xx, yy: integer;
implementation
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
Image.Picture.LoadFromFile ('02.jpg');
y := 0;
x := 0;
xx := Bckg.Width;
yy := Bckg.Height;
r.Top := y; r.Left := x; r.Right := xx; r.Bottom := yy;
i.Top := 0;
i.Left := 0;
i.Right := Image.Width;
i.Bottom := Image.Height;
Bckg.Canvas.CopyRect(r, Image.Picture.Bitmap.Canvas, i);
end;
procedure TForm1.TBChange(Sender: TObject);
begin
r.Top := trunc(y * TB.Position / 100);
r.Left := trunc(x * TB.Position / 100);
r.Right := trunc(xx * TB.Position / 100);
r.Bottom := trunc(yy * TB.Position / 100);
Bckg.Canvas.CopyRect(r, Image.Picture.Bitmap.Canvas, i);
end;
initialization
{$I unit1.lrs}
end.
LFM:
object Form1: TForm1
Left = 237
Height = 768
Top = 110
Width = 1024
Caption = 'Form1'
ClientHeight = 768
ClientWidth = 1024
OnCreate = FormCreate
LCLVersion = '0.9.28.2'
object Bckg: TPaintBox
Left = 0
Height = 768
Top = 0
Width = 1024
end
object Image: TImage
Left = 1040
Height = 768
Top = 102
Width = 1024
end
object TB: TTrackBar
Left = 320
Height = 25
Top = 743
Width = 384
Max = 100
OnChange = TBChange
Position = 100
TabOrder = 0
end
end