在800*600分辨率下开发的应用程序当放到1024*768下运行时!
   怎么样让相应的组件,控件按比例放大!

解决方案 »

  1.   

    from.Scaled:=trueDescriptionIf Scaled is True, and the value of PixelsPerInch differs from the current system settings, the form is scaled to a new size. If Scaled is False, no scaling occurs.
      

  2.   

    unit Unit_FormScale;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
      TForm1 = class(TForm)
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    const
      //假设在800*600的分辨率下设计窗体,则常数定义如下:
      ScreenWidth=800;
      ScreenHeight=600;
    var
      Form1: TForm1;implementation{$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;end.并将from.Scaled设置为true
      

  3.   

    var
    DevMode:TDeviceMode;
    begin
    try
        if(Screen.width<> 800 )then
        begin
          if EnumDisplaySettings(nil,0,DevMode) then
          begin
            DevMode.dmFields:=DM_PELSWIDTH Or DM_PELSHEIGHT;
            DevMode.dmPelsWidth:=800;
            DevMode.dmPelsHeight:=600;
            ChangeDisplaySettings(DevMode,0); //设置新的显示参数
          end;
        end ;
    except
    end ;
    end ;