当前位置:主页>Delphi教程>文章内容
控件在运行状态改变大小
来源: 作者: 发布时间:2007-04-29  

我的主页: http://www.tommstudio.com/

使用下面的方法可以让控件在运行状态改变大小,就像在窗体编辑器中一样.


type
tddhsizebutton=class(tbutton)
public
procedure WmNcHitTest(var msg:TWmNcHitTest);
message wm_NcHitTest;
end;  

procedure TDdhSizeButton.WmNcHitTest(var msg:TWmNcHitTest);
var
pt:tpoint;
begin
  pt:=point(msg.xpos,msg.ypos);
  pt:=ScreentoClient(pt);
  if (pt.x<5) and (pt.y<5) then
  msg.Result:=httopright
  else if (pt.x>width-5) and (pt.y<5) then
  msg.Result:=httopright
  else if (pt.x >width-5) and (pt.y>height-5) then
  msg.Result:=htbottomright
  else if (pt.x<5) and (pt.y>height-5) then
  msg.Result:=htbottomleft
  else if (pt.x<5) then
  msg.Result:=htleft
  else if (pt.y<5) then
  msg.Result:=httop
  else if (pt.x>width-5) then
  msg.Result:=htright
  else if (pt.y>height-5) then
  msg.Result:=htbottom
  else
  inherited;
end;



 
上一篇:XP/2003下开放3389最简单的方法   下一篇:如何取得某些特殊文件夹路径
 
  相关文章
·XP/2003下开放3389最简单的方法
·如何取得某些特殊文件夹路径
·实现Lucas-Kanade光流计算的Delphi类
·url编码与解码工具代码
·强角点检测算子的Pascal实现代码
·一个多线程后台扫描的程序和源代码
·巧用Delphi制作溅射屏幕
·Delphi中对象解除技巧
·使用类方法控制实例的唯一性
·获得Windows的版本信息
·Delphi中的字符串
·“序列号输入助手”源代码
 
【关闭窗口】
推荐本站资源
最新文章