现在要做一个这样的程序,在800*600的分辨率下显示800*600的窗体,在1024*768的分辨率下显示1024*768的窗体,先谢谢了

解决方案 »

  1.   

    Form中定义了一个Screen实例。
    你输入Screen.width Screen.height 取得屏幕的大小然后给forom的大小赋值
      

  2.   

    写方法给你...
    procedure TDMShare.FormAutoSize(AOwner: TComponent; ScreenWidth,
      ScreenHeigth: Integer);
    var
      OldFormWidth:integer;
    begin
      if screen.Width <> screenwidth then
      begin
        oldformwidth:=TForm(AOwner).Width;
        TForm(AOwner).Height:=longint(TForm(AOwner).Height) * longint(screen.height) div ScreenHeigth;
        TForm(AOwner).Width:=longint(TForm(AOwner).Width) * longint (screen.width) div screenwidth;
        TForm(AOwner).ScaleBy(screen.Width+5,screenwidth);
        TForm(AOwner).Font.Size:=(TForm(AOwner).Width div OldFormWidth) * TForm(AOwner).Font.Size;
      end;
    end;
    /////
    ScreenWidth,ScreenHeigth: Integer << 这两个参数填入你在什么环境下开发的,
    AOwner: TComponent << 这是就是应用的窗体..
      

  3.   

    写个方法给你...
    procedure TDMShare.FormAutoSize(AOwner: TComponent; ScreenWidth,
      ScreenHeigth: Integer);
    var
      OldFormWidth:integer;
    begin
      if screen.Width <> screenwidth then
      begin
        oldformwidth:=TForm(AOwner).Width;
        TForm(AOwner).Height:=longint(TForm(AOwner).Height) * longint(screen.height) div ScreenHeigth;
        TForm(AOwner).Width:=longint(TForm(AOwner).Width) * longint (screen.width) div screenwidth;
        TForm(AOwner).ScaleBy(screen.Width+5,screenwidth);
        TForm(AOwner).Font.Size:=(TForm(AOwner).Width div OldFormWidth) * TForm(AOwner).Font.Size;
      end;
    end;
    ////////////
    ScreenWidth,ScreenHeigth: Integer << 填入你在什么方法下面开发的像素...
    AOwner: TComponent;  << 就是应用的窗体..