总结了一下以前的帖子-- 1.字符集的问题。在win2000或xp 下编程时,有必要将窗体的Font的字符集设为Chinese_GB2312,或直接将Font.Charset设为GB2312_Charset;2.可设置form.scaled:=false;3.适应不同的分辨率: 假设你在800*600的分辨率下设计的form,第一步: inplementation const ScreenWidth: LongInt = 800; {I designed my form in 800x600 mode.} ScreenHeight: LongInt = 600;{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject); begin 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.字符集的问题。在win2000或xp 下编程时,有必要将窗体的Font的字符集设为Chinese_GB2312,或直接将Font.Charset设为GB2312_Charset;2.可设置form.scaled:=false;3.适应不同的分辨率:
假设你在800*600的分辨率下设计的form,第一步:
inplementation
const
ScreenWidth: LongInt = 800; {I designed my form in 800x600 mode.}
ScreenHeight: LongInt = 600;{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
begin
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;
在98下打开应用程序时,字和控件都变大了。
如果用delphi打开源程序,里面的字和空间也都是增大的,但是打开.dfm文件看时,里面的尺寸依旧是对的。如果什么也不作,就保存一次,那么dfm文件里的参数就会发生变化!
急啊!