字体没变啊,我在800*600下看,字还是那么大~~~~我用了ThemeEngine控件的~~~ 我在程序中加了如下代码,怎么还是不行~~~~加了下面的代码,就不会有控件在800*600下看不到的情况,但字体的问题还没解决~~~implementation const Orignwidth=1024; Orignheight=768;procedure TForm1.FormCreate(Sender: TObject); begin 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;
二、将机器分辨率更改为设计时的分辨率 这种方法不改变表单本身,而是将屏幕分辨率更改为与表单设计时用到的分辨率相同。它需要用到WINDOWSAPI函数EnumDisplaySettings和ChangeDisplaySettings,前者取当前显示模式信息,后者则更改显示设置,具体参数的含义请参见DELPHI帮助。设计时宽度常量 和高度常量的定义如方法一。procedureTForm1.FormCreate(Sender:TObject); var devmode:tDevicemode; begin ifscreen.width<>orignwidththen begin ifEnumDisplaySettings(nil,0,devmode)then begin devmode.dmfields:=dm_pelswidthORdm_pelsheight; devmode.dmpelswidth:=orignwidth;{宽度} devmode.dmpelsheight:=orignheight;{高度} ChangeDisplaySettings(devmode,0);{更改设置} end; end; end;
在设计时把程序的字体设为:宋体,9号 字符集(Charset)为:GB2312_CHARSET
试试看。
怎么设置??
Charset为GB2312_CHARSET
利用ScaleBy改变分辨率
在设计时,将字体设为宋体 9号 GB2312_CHARSET,
在放到win98运行时,先将win98的分辨率改为1024*768,
就行了
我在程序中加了如下代码,怎么还是不行~~~~加了下面的代码,就不会有控件在800*600下看不到的情况,但字体的问题还没解决~~~implementation
const
Orignwidth=1024;
Orignheight=768;procedure TForm1.FormCreate(Sender: TObject);
begin
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;
Orignwidth=800;
Orignheight=600;procedureTForm1.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;
SCALE过程在调整控件宽度和高度的同时,也自动调整控件字体的大小,以适应新的分辨率, 但美中不足的是它并不改变控件的顶点坐标位置,也就是说,该过程不改变控件之间的相对 位置关系。要想调整控件之间的选队相对位置,还需要自己编程实现,有兴趣的读者可试一 试。
var
devmode:tDevicemode;
begin
ifscreen.width<>orignwidththen
begin
ifEnumDisplaySettings(nil,0,devmode)then
begin
devmode.dmfields:=dm_pelswidthORdm_pelsheight;
devmode.dmpelswidth:=orignwidth;{宽度}
devmode.dmpelsheight:=orignheight;{高度}
ChangeDisplaySettings(devmode,0);{更改设置}
end;
end;
end;
1、 在fromshow事件里写如下代码:
ScaleBy(Round(Screen.Width * 100 / Const_DefaultWidth),100);
2、 把字体设置为宋体,字体大小自己斟酌