New to Telerik UI for WinForms? Download free 30-day trial

Detecting when the User Drags the RadTitleBar

The following example, demonstrates how to detect when the user drags the title bar and to how to get its coordinates:

Detecting when the TitleBar is dragged

public const int WM_WINDOWPOSCHANGED = 0x47;
protected override void WndProc(ref Message m)
{
    if (m.Msg == WM_WINDOWPOSCHANGED)
    {
        this.Text = Control.MousePosition.ToString();
    }
    base.WndProc(ref m);
}

Public Const WM_WINDOWPOSCHANGED As Integer = 71
Protected Overloads Overrides Sub WndProc(ByRef m As Message)
    If m.Msg = WM_WINDOWPOSCHANGED Then
        Me.Text = Control.MousePosition.ToString()
    End If
    MyBase.WndProc(m)
End Sub

In this article