我可以提供一些想法
获得鼠标在点击from时的x,y然后在onmousemove中进行限制就应该可以了
具体程序自己写吧我是用bcb的

解决方案 »

  1.   

    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是我自己调整的,你可以更换