控件在运行状态改变大小

翻译|其它|编辑:郝浩|2005-08-09 09:50:00.000|阅读 1405 次

概述:

# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>


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

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;

 


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com


为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP