在1024*768下设计的窗体,在800*600下显示时过大,满屏幕都显示不完,高手们有什么办法?

解决方案 »

  1.   

    窗体设计时要注意布局,可以研究一下组件的Align属性,如果窗体里各个组件
    都设置好了Align,窗体大小变动对组件显示是不会有影响的。自己研究一下吧
      

  2.   

    我也不知道能不能行,你自己试下吧
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation
      Const
      ScreenWidth: LongInt = 800;
      ScreenHeight: LongInt = 600;{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    var OldFormWidth: Integer;
    begin
      Scaled := True;
      if Screen.Width <> ScreenWidth then
      begin
        OldFormWidth := Width;
        Height := LongInt(Height) * LongInt(Screen.Height) div ScreenHeight;
        Width := LongInt(Width) * LongInt(Screen.Width) div ScreenWidth;
        ScaleBy(Screen.Width,ScreenWidth);
        font.Size := (Width div OldFormWidth) * Font.Size;
      end;
    end;end.
      

  3.   

    程序运行时先检测分辨率
      if Screen.Width = 1024 then
      begin
        //设置窗体最大化
        Self.WindowState := wsMaximized;
      end
      else 
      begin 
        //大小自己定
        Self.Width := 800;
        Self.Height := 600;
      end;
      

  4.   

    const
      ScreenWidth: LongInt = 800; {I designed my form in 800x600 mode.}
      ScreenHeight: LongInt = 600;
      Orignwidth=800;
     Orignheight=600;
    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);