窗体最大化后,其中的所有控件按比列放大如何操作呢??
先谢谢了!
先谢谢了!
解决方案 »
- delphi调用dos命令更改网卡IP参数,以及顺序执行DOS命令的问题
- 为什么i初始值总是等于4365832?
- 如何在另一个项目中重用remote data module??
- 谁有BMP转JPG的DLL或OCX,发给我,100分送上
- ExpressQuantumGrid Suite V5有没有FOR D6的及其补丁,哪有下?
- 打包程序安装过程中出现“Modifying of .cfg failed:5”的错误!
- 我的角怎么一会儿一个,一会儿两个
- 吃内存,哪位高手指点一下
- 有什么语法错误吗,急,高分
- delphi 5.0 不能安装VCL
- 请问该如何访问一个web上的mdb文件,急
- 急!在FORM中动态调用dll后,关闭应用程序后出错的问题?
判断当前窗口缩放的比例罗,然后遍历窗体上的控件 width和height 都乘上这个比例!
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
Edit1: TEdit;
procedure FormResize(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
OldWinWidth : integer;
OldWinHeight : integer;
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormResize(Sender: TObject);
var
WRate,HRate : double;
i : integer;
begin
WRate := Form1.Width / OldWinWidth;
HRate := Form1.Height / OldWinHeight;
for i := 0 to Form1.ControlCount - 1 do
begin
if Form1.Controls[i] is TPanel then
begin
(Form1.Controls[i] as TPanel).Width :=trunc( (Form1.Controls[i] as TPanel).Width*WRate);
(Form1.Controls[i] as TPanel).Height :=trunc( (Form1.Controls[i] as TPanel).Height*HRate);
end
else if Form1.Controls[i] is TButton then
begin
(Form1.Controls[i] as TButton).Width :=trunc( (Form1.Controls[i] as TButton).Width*WRate);
(Form1.Controls[i] as TButton).Height :=trunc( (Form1.Controls[i] as TButton).Height*HRate);
end
else if Form1.Controls[i] is TEdit then
begin
(Form1.Controls[i] as TEdit).Width :=trunc( (Form1.Controls[i] as TEdit).Width*WRate);
(Form1.Controls[i] as TEdit).Height :=trunc( (Form1.Controls[i] as TEdit).Height*HRate);
end
//......
//其他类型的控件。
//......
end;
OldWinWidth :=Width;
OldWinHeight :=Height;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
OldWinWidth := Width;
OldWinHeight := Height;
end;end.