怎样使在800*600像素开发的程序,在1024*768中正常显示?

解决方案 »

  1.   

    所以控件的字体都必须是宋体小五号字符集Chinese_GB2312
      

  2.   

    Another_eYes (1998-11-22 22:39:29)  
    implementation
    const
      ScreenWidth: LongInt = 800; {I designed my form in 800x600 mode.}
      ScreenHeight: LongInt = 600;{$R *.DFM}procedure TForm1.FormCreate(Sender: TObject);
    begin
      scaled := true;
      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;下面是解决字体大小的代码:
    USES typinfo;  {Add this to your USES statement.}var
      i: integer;
    begin
      for i := componentCount - 1 downto 0 do
        with components[i] do
        begin
          if GetPropInfo(ClassInfo, 'font') <> nil  then
            font.size := (NewFormWidth DIV OldFormWidth) * font.size;
        end;
    end;
      

  3.   

    一个笨办法:
    写个系统配置文件,
    分别保存在800*600和1024*768底下的各控件的位置属性(大小、位置等)。
    在程序运行时,根据用户的分辨率来载入。最好最简单就是改用户的分辨率。不过在nt/2000/xp底下出了改分辨率,还要改刷新率,
    不然会变为默认的60hz。要要的话,给个邮箱,我编个改用户分辨率和刷新率的demo给你发过去。
      

  4.   

    好的![email protected]但我的想法是程序能自动适应两种状态。即在800*600下能显示,在1024*768也能正常显示