如果你的Form Style=bsDialog,bsSizeToolWin,bsToolWindow
你只要截获WM_NCHITTEST就可以了,
procedure WMNCHitTest(var Msg: TWMNCHitTest);message WM_NCHitTest;
程序中:
procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);
begin
inherited;
with Msgdo
if Result in[HTCAPTION] then
Result:= HTNOWHERE
end;
如果你的Form Style=bsSingle,bsSizable
你还要截获WM_INITMENUPOPUP
procedure WMInitMenuPopup(var Msg: TWMInitMenuPopup);
message WM_INITMENUPOPUP;
程序中:
procedure TForm1.WMInitMenuPopup(var Msg: TWMInitMenuPopup);
begin
inherited;
if Msg.SystemMenu then
EnableMenuItem(Msg.MenuPopup, SC_MOVE, MF_BYCOMMAND or MF_GRAYED)
end;