我整理的:在win2000或xp 下编程时,记住将窗体的Font的字符集设为Chinese_GB2312,或直接将Font.Charset设为GB2312_Charset另外,有时还要将窗体的Scaled属性设为false(绝大多数情况下没有必要).控件的parentFont如果为true(默认),则窗体的字符集变了,它们的也会跟着变,没有必要逐个设置;除非控件的字体特殊,有别于窗体,则需要单独设置。还有适应分辨率的问题: 假设你在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;
假设你在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;