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;各位仁兄,小弟我用上面的代码,对于自适应分辩率好像不起作用,并且我边缘有些控件就没有显示
以前1024*768,改成800*600不行了,各位help me!小弟我真的真的没有可用分,只能深深的祝大家身体健康,事业进步

解决方案 »

  1.   

    不要在Create中写,在Paint中或在Show中写
      

  2.   

    To ICMGDCHN(广东人在广州->喜欢明月) 各位仁兄,小弟我用上面的代码,对于自适应分辩率好像不起作用,并且我边缘有些控件就没有显示
    以前1024*768,改成800*600不行了,各位help me!小弟我真的真的没有可用分,只能深深的祝大家身体健康,事业进步
      

  3.   

    你检查一下你的两个常量是否附值错误,ScreenHeight,ScreenWidth
      

  4.   

    实在不行,用这个控件吧:ElasicForm;
      

  5.   

    NND,很久没来了,csdn已经取消捐分功能了,看来楼主兄弟只好卖身了.
      

  6.   

    没money,也没有MM,就连CSDN上可用分也没有,问题也始终解决不了,真是心寒。
      

  7.   

    窗体在不同分辨率下的大小和控件位置、变形问题:在800*600下做了一个FORM,但到640*480下一看却变了形,控件的相对位置都变了,不知道如何解决,请教诸位高手。Another_eYes (1998-11-22 22:39:29)  
    implementation
    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;下面是解决字体大小的代码:
    USES typinfo;  {Add this to your USES statement.}var
      i: integer;
    begin
      for i := componentCount - 1 downto 0 do
        with components[i] do
        begin
          if GetPropInfo(ClassInfo, 'font') <> nil  then
            font.size := (NewFormWidth DIV OldFormWidth) * font.size;
        end;
    end;下面的函数可以解决问题:
    Form:需要调整的Form,OrgWidth:开发时屏幕的宽度,OrgHeight:开发时屏幕的高度。
    注意:需要把Form的Scaled设置为True。
    procedure AdjustForm(Form: TForm; const OrgWidth, OrgHeight: integer);
    begin
      with Form do
      begin
        Width := Width * Screen.Width div OrgWidth;
        Height := Height * Screen.Height div OrgHeight;
        ScaleBy(Screen.Width, OrgWidth);
      end;
    end;
     
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      AdjustForm(Self,1280,1024);
    end;
      

  8.   

    To jinjazz(近身剪(N-P攻略))非常感谢 老师,非常感谢,不过依然是有些控件看不到,分辨率更改后,控件的相对位置发生的变化,俺的控件都是放在panel或groupbox!请问老师有何高见了
      

  9.   

    perhaps adjust all controls?
      

  10.   

    使用 Align 属性来对齐,用 Panel 或者是别的控件组合好。Delphi 中应该有一个例子的,可以拿来看看。这样就不需要去对付分辨率的问题了。
      

  11.   

    To CloneCenter(复制中心)            兄弟,能不能详细一点,谢谢
      

  12.   

    各位兄弟,我再详细一些是这样的:主窗体我就设置了:windowState为wsMaximized。
    窗体上有三个panel.align值分为为altop、altop、alclient.但但是一更改800*600,panel1上的控件有些就显示不出来,请高手相助
      

  13.   

    Panel如果太小了,或者说Panel上的控件太多了,那可能就是比较麻烦。
      

  14.   

    CloneCenter(复制中心) 高手您是怎么避免分辩率的问题了?