Breyta

Deila með


Window.DragMove Method

Definition

Allows a window to be dragged by a mouse with its left button down over an exposed area of the window's client area.

public:
 void DragMove();
[System.Security.SecurityCritical]
public void DragMove ();
public void DragMove ();
[<System.Security.SecurityCritical>]
member this.DragMove : unit -> unit
member this.DragMove : unit -> unit
Public Sub DragMove ()
Attributes

Exceptions

The left mouse button is not down.

Examples

The following example shows how to override OnMouseLeftButtonDown to call DragMove.

protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
    base.OnMouseLeftButtonDown(e);

    // Begin dragging the window
    this.DragMove();
}
Protected Overrides Sub OnMouseLeftButtonDown(ByVal e As MouseButtonEventArgs)
    MyBase.OnMouseLeftButtonDown(e)

    ' Begin dragging the window
    Me.DragMove()
End Sub

Remarks

The left mouse button must be down when DragMove is called. One way to detect when the left mouse button is pressed is to handle the MouseLeftButtonDown event.

When DragMove is called, the left mouse button must be depressed over an exposed area of the window's client area.

Note

This method cannot be called when a window is hosted in a browser.

Applies to

See also