想用delphi实现:让程序能够在不同的分辨率下正常显示.

解决方案 »

  1.   

    如果主屏幕有grid,memo等大量占用屏幕的控件,就让grid的align设置为alClient,如果都是edit的输入框,就不要设置了,否则极其难看
      

  2.   

    假设你在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;   
      

  3.   

    请加入QQ高级群:9642802,在群的共享里有个组件"EasySize",组件的作用是控制窗口在不同分辨率下窗口都能成比例的缩放,窗口中的控件也会随窗口的大小变化,自动成比例缩放;使用方法很简单,拖个控件放到界面上,2句代码搞定。
    1、FormCreate事件中: 
      FormResizer1.InitializeForm; 
    2、FormResize事件中: 
      FormResizer1.ResizeAll;