`

delphi程序适应屏幕分辨率

阅读更多

delphi程序适应屏幕分辨率
先在表单单元的Interface部分定义两个常量,表示设计时的屏幕的宽度和高度(以像素为单位)。在表单的Create事件中先判断当前分辨率是否与设计分辨率相同,如果不同,调用表单的SCALE过程重新能调整表单中控件的宽度
和高度。
Const
   Orignwidth=800;
   Orignheight=600;
procedure TForm1.FormCreate(Sender:TObject);
begin
   scaled:=true;
   if (screen.width<>orignwidth) then
   begin
     height:=longint(height)*longint(screen.height)divorignheight;
     width:=longint(width)*longint(screen.width)divorignwidth;
     scaleby(screen.width,orignwidth);
   end;
end;

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics