我在2000下做了个软件,没什么问题,但到98下界面就变大了很多,字和控件都变大了。以前的字是宋体,小五,到98下就变成了四号了!
怎么回事啊?如何解决?

解决方案 »

  1.   

    总结了一下以前的帖子--
    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;
      

  2.   

    首先感谢silverwonder(沧浪之水清兮,可以濯我瀴)
    在98下打开应用程序时,字和控件都变大了。
    如果用delphi打开源程序,里面的字和空间也都是增大的,但是打开.dfm文件看时,里面的尺寸依旧是对的。如果什么也不作,就保存一次,那么dfm文件里的参数就会发生变化!
    急啊!
      

  3.   

    98和me 的字体库和2000,xp是不一样的,所以会出现你所说的情况把form的字体属性设为宋体;字符集delphi默认是西方;把它改为Chinese_GB2312
      

  4.   

    对,关键的就是这几点,字体要设为系统通用的中文字体,字符集要设为CHINESE_GB2312
      

  5.   

    我的经验是,保留form的默认字体不动,其他组件根据需要才修改成其他字体,如果要改的组件多就搞个panel上去,只改panel的字体。这样无论去哪都不会变了。