| 网站首页 | Vip会员区 | 教程 | 软件 | 图片 | QQ家园 | 免费资源 | 在线服务 | 论坛 | 博客 | 程序开发 | It学堂 | 作品发布 | 
站点相关
代刻黑客光盘或订做光盘

精品软件程序定制

为您的网站或者服务器保驾护航
相关内容
最 新 热 门
相 关 文 章
没有相关文章
您现在的位置: 红色黑客联盟 >> 程序开发 >> 软件开发 >> Delphi >> 正文
控件在运行状态改变大小
文章录入:7747.Net    责任编辑:7747.Net  更新时间:2008-1-15 17:37:14

【字体:

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


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;

您对本文章有什么意见或着疑问吗?请到论坛讨论您的关注和建议是我们前行的参考和动力
  • 上一个文章:

  • 下一个文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
     | 设为首页 | 加入收藏 | 广告服务 | 我要投稿 | 关于我们 | 版权申明 | 免责声明 | 隐私声明 | 网站地图 |