我是在2000下开发的程序在98下看起来会有很大不同所以想根据屏幕分辨率自动调整窗体位置和大小,不知道该如何处理,望高手赐教

解决方案 »

  1.   

    一、设置字体:如都设置为“宋体”,这样2000与98显示字体统计二、
      Screen.Width  为屏幕分辨率的宽
      Screen.Height  为屏幕分辨率的高
    在OnShow中设置一下Form的Left,Top,Width,Height 属性
      

  2.   

    http://expert.csdn.net/Expert/topic/1225/1225868.xml?temp=.3993799
      

  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
      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;下一步,要让每个子控制的字体改变到合适的大小:
    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;
      

  4.   

    理论上是rouqing(*柔情似水&冷酷到底*) 的方法,可实际上你做的时候发现这样真的是不太好的,还记得把字体设为 宋体 gbchinese2312
      

  5.   

    Screen.Width  为屏幕分辨率的宽
      Screen.Height  为屏幕分辨率的高
    在OnShow中设置一下Form的Left,Top,Width,Height 属性