我的显示器是17'的,但把Delphi程序用15'的显示器显示就不能完全显示,就是说我的程序不能适应不同的显示器,怎么解决这个问题?请赐教。

解决方案 »

  1.   

    我看主要是显示分辨率的问题,如果显示分辨率相同的话应该不会出现你说的问题。你可以通过Screen对象得到当前显示分辨率,然后自己控制显示。
      

  2.   

    我也遇到相同的问题,设计界面的时候最好在小一点的显示器上。如果在大的显示器上设计最好将分辨率调小一点,因为人画界面的时候总是以屏幕大小为基准,如果你在1024 X 768下画了个900 X 800 的窗体,在1024 X 768下显得很自然,但拿到800 X 600下肯定显示不下的。
    另外设计控件的align属性设置时麻烦更大,不是到了大显示器上窗体出现空白,就是某些控件变的很大。
    自己写代码控制很麻烦
    如果borland在IDE中提供了这样的功能多好啊,期待delphi8.0中有这样的功能
      

  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;