I want to capture mouse events when the mouse is positioned on the title bar of a form. In particular I want to be able to replace the standard context menu (to move, size, maximize, minimize, close) with one of my own.

Can anyone help please?

Hi, You have to override Window Procedure for the particular form. I give example that shows Context menu when user right click on the Title bar

    Public Const WM_NCRBUTTONUP = &HA5
    Dim ContMenu As ContextMenuStrip

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ContMenu = New ContextMenuStrip()
    End Sub

    Protected Overrides Sub WndProc(ByRef WndMsg As System.Windows.Forms.Message)
        If WndMsg.Msg = WM_NCRBUTTONDOWN Then
            Return ' Prevent to process this Message to the Base Class
        End If
    End Sub

This example just override the Context menu, but still if user click on the Top Left corner or Alt + Space it will show the context menu. If you want to change this menu you have to go for Win32 API.

This question has already been answered. Start a new discussion instead.