控件在运行状态改变大小
使用下面的方法可以让控件在运行状态改变大小,就像在窗体编辑器中一样
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;
补充:软件开发 , Delphi ,