procedure OnWindowMove(var Msg:TMessage); message WM_WINDOWPOSCHANGING;procedure TShareForm.OnWindowMove(var Msg: TMessage); var CurPos:^WINDOWPOS; begin CurPos:=ptr(Msg.lParam); // handle the state of window minimized if (CurPos.y>MainForm.ClientHeight-(self.Height-self.ClientHeight)-10) and(CurPos.y<MainForm.ClientHeight-(self.Height-self.ClientHeight)+10) then exit; if CurPos.x<0 then CurPos.x:=0; if CurPos.y<0 then CurPos.y:=0; if CurPos.y>MainForm.ClientHeight-Self.Height-10 then CurPos.y:=MainForm.ClientHeight-Self.Height-10; if CurPos.x>MainForm.ClientWidth-Self.Width then curPos.x:=MainForm.ClientWidth-Self.Width-4; end;常数10和4是我自己调整的,你可以更换
var
CurPos:^WINDOWPOS;
begin
CurPos:=ptr(Msg.lParam);
// handle the state of window minimized
if (CurPos.y>MainForm.ClientHeight-(self.Height-self.ClientHeight)-10)
and(CurPos.y<MainForm.ClientHeight-(self.Height-self.ClientHeight)+10) then
exit;
if CurPos.x<0 then CurPos.x:=0;
if CurPos.y<0 then CurPos.y:=0;
if CurPos.y>MainForm.ClientHeight-Self.Height-10 then
CurPos.y:=MainForm.ClientHeight-Self.Height-10;
if CurPos.x>MainForm.ClientWidth-Self.Width then
curPos.x:=MainForm.ClientWidth-Self.Width-4;
end;常数10和4是我自己调整的,你可以更换