delphi2007 教程

delphi2007 教程

首页 新随笔 联系 聚合 管理
  1013 Posts :: 0 Stories :: 28 Comments :: 0 Trackbacks
怎么样才可以使得窗体中的控件随窗体变化而变化 Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiAPI/html/delphi_20061108163345274.html
怎么样才可以使得窗体中的控件随窗体变化而变化

设置Align和Anchors属性

在窗体的OnResize事件里重新设置一个目标控件的Left、Top、Width与Height值即可  
 

如果想要控件的位置变而大小不变,可以这样:  
  procedure   TForm1.FormResize(Sender:   TObject);  
  begin  
   
      Button1.Left:=round(left*clientwidth/fwidth);  
      Button1.Top:=round(top*clientheight/fheight);  
   
  end;  
  其中left,top   是最初button1的left与top值,fwidth,fheight是最初form1的width与height值.

posted on 2009-04-08 09:12 delphi2007 阅读(276) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。