为什么win2k下编写的程序,在win98下运行这么难看?特别是label botton他们的位置变化?
解决方案 »
- dxdbtreeview 无端删节点?
- 在用comboBox做查询时出现的问题,请各位看看!
- 请指教,如何将access数据库导出为mysql数据库?
- c++builder写客户端调用由Java写服务端的WebService问题? 发布到Tomcate中
- MIDAS指的是什么?谢谢指点
- 对于delphi的新手,不知各位高手有什么好的学习的经验和建议相赠吗?
- 是不是用ADO连接方式效率低?
- 有没有增强的类DBNavigator控件?
- 大家帮帮忙,我的朋友做了软件,他现在很急,很可怜,很菜,很无助
- toolbar97 for Delphi5的控件,急!!!!!!!!!!!!!
- 我制作的一个AVG Game Demo 欢迎大家测试
- delphi 6中文在线帮助 谁有啊.
系統字體的變化都有可能引起//Form's Create(Form適應其它分辨率)
procedure SetFormCreate(Sender: TForm);
begin
with Sender do
begin
Width := FrmMain.myClientWidth;
Height := FrmMain.myClientHeight;
Top := (FrmMain.myClientHeight - Height) div 2;
Left := (FrmMain.myClientWidth - Width) div 2; Scaled := True;
if (Screen.Width <> OrignWidth) then
begin
Height := LongInt(Height) * LongInt(Screen.Height) div OrignHeight;
Width := LongInt(Width) * LongInt(Screen.Width) div OrignWidth;
ScaleBy(Screen.Width, OrignWidth);
end;
end;
end;
其它控件的ParentFont属性默认值为:true
不要用delphi的默认设置。
implementationconstScreenWidth: LongInt = 800; {I designed my form in 800x600 mode.}ScreenHeight: LongInt = 600;{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);beginscaled := true;if (screen.width <> ScreenWidth) thenbeginheight := longint(height) * longint(screen.height) DIV ScreenHeight;width := longint(width) * longint(screen.width) DIV ScreenWidth;scaleBy(screen.width, ScreenWidth);end;end;下面是解决字体大小的代码:USES typinfo; {Add this to your USES statement.}vari: integer;beginfor i := componentCount - 1 downto 0 dowith components[i] dobeginif GetPropInfo(ClassInfo, 'font') <> nil thenfont.size := (NewFormWidth DIV OldFormWidth) * font.size;end;end;下面的函数可以解决问题:Form:需要调整的Form,OrgWidth:开发时屏幕的宽度,OrgHeight:开发时屏幕的高度。注意:需要把Form的Scaled设置为True。procedure AdjustForm(Form: TForm; const OrgWidth, OrgHeight: integer);beginwith Form dobeginWidth := Width * Screen.Width div OrgWidth;Height := Height * Screen.Height div OrgHeight;ScaleBy(Screen.Width, OrgWidth);end;end; procedure TForm1.Button1Click(Sender: TObject);beginAdjustForm(Self,1280,1024);end;