]、。·ˉˇ¨〃々—~‖…’”〕〉》」』〗】∶!"'),.:;?]` 拦截wm_NcHitTest即可,例如:
type
tmybutton=class(tbutton)
public
procedure WmNcHitTest(var msg:TWmNcHitTest);message wm_NcHitTest;
end;
procedure TMyButton.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;