想用delphi实现:让程序能够在不同的分辨率下正常显示.
解决方案 »
- Accesss数据库——语法错误,操作符丢失
- 同一字段不同记录更新不同信息的sql语句
- 报表问题请教,急!
- 怎么在delphi中实现图片的滚动呢???没做过这个!!!大虾们帮帮忙!!!SOS
- 我是新手,想问个简单问题,关于数据连接?50
- form关闭的问题
- 关于Delphi的Dll编程问题,高分相赠!!!!
- 为什么Window2000+Delphi6开发的窗口,在Windows98下却变大了许多(在线等待)
- 如何DATAGRID 单元格校验,和更新扑获错误
- 我有一个C++的头,它里边声明的东西在Delphi里如何定义?
- 求助,image搞的图片如何实现滚轮缩放以及鼠标拖动查看图片
- 请教高手:如何动态生成右键菜单修改StringGrid中内容
inplementation
const
ScreenWidth: LongInt = 800; {I designed my form in 800x600 mode.}
ScreenHeight: LongInt = 600;
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
scaled := true;
if (screen.width <> ScreenWidth) then
begin
height := longint(height) * longint(screen.height) div ScreenHeight;
width := longint(width) * longint(screen.width) div ScreenWidth;
scaleBy(screen.width, ScreenWidth);
end;
end;
下一步,要让每个子控制的字体改变到合适的大小:
type
TFooClass = class(TControl); { needed to get at protected }
{ font property }
var
i: integer;
begin
for i := ControlCount - 1 downto 0 do
TFooClass(Controls[i]).Font.Size :=
(NewFormWidth div OldFormWidth) *
TFooClass(Controls[i]).Font.Size;
end;
1、FormCreate事件中:
FormResizer1.InitializeForm;
2、FormResize事件中:
FormResizer1.ResizeAll;