站内搜索:     
站点首页破釜学院编程开发Delphi → 控件在运行状态改变大小
正在加载相关信息.....
Web 站内搜索
控件在运行状态改变大小
】【打印】【加入收藏】【关闭收藏到新浪ViVi】【收藏到365KEY】 浏览字号:
日期:2005-08-14 人气: 出处:srw 的 Blog 作者: srw

我的主页: 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;



>>>> 进入论坛交流 <<<<