Q&A

  • 마우스 포인트
마우스 포인트가 폼을 벗어남을 알고 싶은데요
1  COMMENTS
  • Profile
    BravoJW 2002.05.02 19:27
    GetCapture()라는  windows API 함수를 이용하여 구현하면됩니다.

    예)

    procedure TForm1.FormDeactivate(Sender: TObject);
    begin
            ReleaseCapture;
    end;

    procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
    Y: Integer);
    begin
            If GetCapture = 0 then
                    SetCapture(Form1.Handle);
            if PtInRect(Rect(Form1.Left, Form1.Top, Form1.Left + Form1.Width, Form1.Top + Form1.Height),
                    ClientToScreen(Point(x, y))) then
                    Form1.Caption := 'Mouse is over form'
            else
                    Form1.Caption := 'Mouse is outside of form';
    end;