ReleaseCapture (user32)
Last changed: -216.24.45.28

.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern bool ReleaseCapture();

VB.NET Signature:

<DllImport("user32.dll")> _
Private Shared Function ReleaseCapture() As Boolean
End Function

User-Defined Types:

None.

Notes:

None.

ReleaseCapture will delegate mousedown events to underlying controls.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

I use the ReleaseCapture() function to provide drag functionality. for example the following code will allow the user to drag a control around a form : (skipping all declares)

private void control_MouseDown(object sender, MouseEventArgs e)
{
   Control ctrl = sender as Control;
   ReleaseCapture(ctrl.Handle);
   int nul =0;
   SendMessage(ctrl.Handle, WM_SYSCOMMAND, MOUSE_MOVE, ref nul);
  }

Alternative Managed API:

Do you know one? Please contribute it!

Documentation