本文整理自网络,侵删。
关键代码如下:
var
Form1: TForm1;
x,y:Integer;
implementation
{$R *.dfm}
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
if TrackBar1.Position=0 then
begin
image1.Width:=x;
image1.Height:=y;
Exit;
end;
image1.Width:=Ceil(x*( TrackBar1.Position));
image1.Height:=Ceil(y*( TrackBar1.Position));
image1.Top:=Ceil(1/2*(Self.Height-image1.Height));
Image1.Left:=Ceil(1/2*(Self.Width-image1.Width));
end;
procedure TForm1.FormShow(Sender: TObject);
begin
x:=image1.Width;
y:=image1.Height;
image1.Top:=Ceil(1/2*(Self.Height-image1.Height));
Image1.Left:=Ceil(1/2*(Self.Width-image1.Width));
end;
end.
需要引用Math单元..
相关阅读 >>
Delphi 如何使用findfirst搜索不同的文件类型?
Delphi debug模式下可以但是release模式下报错原因之一
Delphi 通过 arp 协议获取局域网内指定 ip 地址的机器的 mac 地址
Delphi2010中使用pchar时e2010 incompatible types: 'char' and 'ansichar' 错误的处理
Delphi实现win10下Delphi 10.3.1 inline hook 域名转向之internetconnecta
更多相关阅读请进入《Delphi》频道 >>