为什么win2k下编写的程序,在win98下运行这么难看?特别是label botton他们的位置变化?

解决方案 »

  1.   

    分辨率的改變
    系統字體的變化都有可能引起//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;
      

  2.   

    在做程序时,一定要先修改 Form 啦什么的控件的字体修改成 宋体 GB2312字符集 9号或10号字就OK了
      

  3.   

    主要是字符集不相容!将窗体的font的CHARSET属性设为DEFAULT_CHARSET或者GB2312_CHARSET再重新编译就行了
      

  4.   

    如果不愿意修改的话 可以分别在不同的系统编译 然后在程序启动的时候判断操作系统的类型来选择启动的程序 反正delphi的编译速度大家都有信心三 ^_^
      

  5.   

    主窗体FONT设置为:宋体,9号字。
    其它控件的ParentFont属性默认值为:true 
    不要用delphi的默认设置。
      

  6.   


    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;