我的窗体是在1024,满屏下面做的!可是一到800*600下就有些东西显示不了啦!怎么解决啊!?  比如加的满屏的图片,和状态条!

解决方案 »

  1.   

    我一般都是用小的分辨率做程序,即便是你的显示器显示的分辨率比较大,在做程序的时候也要注意,你的窗口不要的宽和高不要超过800*600(这是最基础的分辨率).当然也可以用一些其他的方法来实现,让你的程序适应不同的分辨率,但是这样做起来很麻烦,就是动态的改变你的每一个控件的top属性和left属性,但是这样做太麻烦了,所以我没用过.
      

  2.   

    以前学的,请参考:
    程序如何自适应显示器界面?
    =====================================
    screen.width
    screen.height屏幕的大小Form1.Scaled := false;
    ======================================
    Type
      TFooClass = class(TControl); //在此加入聲明
    var
      BaseForm: TBaseForm;
    Const
      ScreenWidth=1024;  //此為設計時的分辨率的寬   現假設為:800 x 1024implementation{$R *.DFM}procedure TBaseForm.FormCreate(Sender: TObject);
    var 
        I,NewFormWidth,OldFormWidth: Integer;
    begin
      if (screen.width <> ScreenWidth) then    //變更窗體及控件大小及字體,以適應不同分辨率的要求
      begin
        OldFormWidth := Width;
        Scaled := True;
        ScaleBy(Screen.Width, ScreenWidth);
        NewFormWidth := Width;
        for i := ControlCount - 1 downto 0 do
          TFooClass(Controls[i]).Font.Size := (NewFormWidth div OldFormWidth)*TFooClass(Controls[i]).Font.Size;
      end;
    end;
    =============================================================
    可以让显示器适应你的软件,软件运行时变成你设置的,退出后回到原来状态.
    var
      main: Tmain;
      oldwidth,oldheight,oldfreq:integer;//记录原来状态
    procedure Tmain.FormCreate(Sender: TObject);
    begin
      setscreen(1024,768,85);//设置新的状态
    end;
    procedure Tmain.FormDestroy(Sender: TObject);
    begin
    setscreen(oldwidth,oldheight,oldfreq);//恢复原来的状态
    end;
    procedure Tmain.setscreen(newwidth, newheight, newfrquency:integer);
    var
      devmode:Tdevicemode;
    begin
      OldWidth:=GetSystemMetrics(SM_CXSCREEN);
      OldHeight:=GetSystemMetrics(SM_CYSCREEN);
      if (oldwidth<>newwidth) and (oldheight<>newheight) then
      begin
      DevMode.dmSize:=sizeof(TDeviceMode);
      EnumDisplaySettings(nil, DWORD(-1), DevMode);
      DevMode.dmFields:=DM_PELSWIDTH or DM_PELSHEIGHT or DM_DISPLAYFREQUENCY;
      DevMode.dmPelsWidth:=NewWidth;
      DevMode.dmPelsHeight:=NewHeight;
      OldFreq:= DevMode.dmDisplayFrequency;
      DevMode.dmDisplayFrequency:=newfrquency;
      ChangeDisplaySettings(DevMode,0);
      end;
    end;
    //显示器烧了可别怪我!:)===============================================================
    不同分辨率下的屏幕控制:procedure TForm1.FormCreate(Sender: TObject);
    const
      ScreenWidth: LongInt = 800; {在800*600下开发的界面.}
      ScreenHeight: LongInt = 600;
    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;
    =======================================
    假設你在1024*780的分辨率下的form,第一步:
    inplementation
    const
      ScreenWidth: LongInt = 1024; {I designed my form in 800x600 mode.}
      ScreenHeight: LongInt = 780;{$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;
    ============================================
    ==============================================
    =======可行办法===============================
    分辨率的问题
    不同的分辨率下原来的窗口界面可能变得面目全非,对于这种问题,我一般采取以下方式: 
    先取得分辨率方法有如下: 
    procedure TForm1.FormCreate(Sender: TObject); 
    var 
    sx,sy:Integer; 
    begin 
    sx := GetSystemMetrics(SM_CXSCREEN); //分辨率宽 
    sy := GetSystemMetrics(SM_CYSCREEN); //分辨率高 
    end; 
    也可以用Screen.width/Screen.Height来取得 
    也可以用Var DevMode:TDeviceMode; 
    Begin 
    EnumDisplaySettings(nil,0,DevMode)  
    sx := DevMode.dmPelsWidth  
    sy := DevMode.dmPelsHeight 来取得 
    end 
    也可以用sx := GetDeviceCaps(GetDC(Form1.Handle), HORZRES) 
    sx :=GetDeviceCaps(GetDC(Form1.Handle), VERTRES) 来取得而后有以下几种方法:
    1. 判断分辨率并选择相应的分辨率方案; 
    (对每种分辨率设计一套控件/字体的大小方案用于在不同分辨率下选择)
    2. 固定窗口大小; 
    procedure TForm1.FormResize(Sender: TObject); 
    begin 
    width:=640; height:=480; 
    left:=0; top:=0; 
    end; 
    3. 使用procedure ScaleBy(M, D: Integer)这个过程来对可视控件进行大小调节(此过程不调节窗口大小,也不变动控件的left和top,对控件的大小按M/D比例来调节),具体如下: 
    procedure TForm1.FormCreate(Sender: TObject); 
    //假设原来的设计环境为800x600 
    var FWidth:integer; 
    begin 
    if(Screen.width<> 800)then 
    begin 
    FWidth:=Width; 
    Scaled:=TRUE; 
    Font.Size:=(Width DIV FWidth)*Font.Size;//字体大小调整 
    ScaleBy(Screen.Width,800); //控件大小调整 
    Height:=longint(Height)*longint(Screen.Height)DIV 600;  
    Width:=longint(Width)*longint(Screen.Width)DIV 800;//窗口大小调整 
    end; 
    end; 
    用此种方法比较实用,而且使用比较简单,基本能适应大多数环境。 4. 调节分辨率到所需的分辨率(即设计时的分辨率,此法对要求封闭的系统比较有用,如工控、触摸屏等等) 
    procedure TForm1.FormCreate(Sender: TObject); 
    var   FWidth:integer; 
    DevMode:TDeviceMode; 
    begin 
    if(Screen.width<> 800)then 
    begin 
          Result:=EnumDisplaySettings(nil,0,DevMode); //取得旧的显示参数 
          if Result then 
          begin 
            DevMode.dmFields:=DM_PELSWIDTH Or DM_PELSHEIGHT; 
             DevMode.dmPelsWidth:=800; 
            DevMode.dmPelsHeight:=600; 
    ChangeDisplaySettings(DevMode,0); //设置新的显示参数 
    end; 
    end; 
    end;
    5. 设置控件的Align和Anchors属性================================================
    =====================================================
    推荐你使用:Anchors属性,将其设置为[akTop,akLeft,akBottom,akRight]
    Anchors属性指的是你所使用的可视化控件距离窗体边缘的值是否固定;
    例如:akTop=True,表示离窗体top固定配合Align属性的AlClient尤其的爽,多试一试,常用panel=======================================================
      

  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;