Link to home
Start Free TrialLog in
Avatar of ommer
ommer

asked on

windows toolbar dropdown button

Dear Dotnet Experts,

I have developed a window app in vs2003. On this form I have a toolbar. One of the button is of dropdown style. As it is right now, mouse clicks on the main icon area of the button will do nothing. Only clicks to its arrow down area (the narrower strip on right side) will make the dropdown menu show.

Does any one know how to make the click on the main icon area has the same effect as clicking on the down arrow?

Thanks!
Avatar of theGhost_k8
theGhost_k8
Flag of India image

the code below will allow u to catch click on Titlebar.

    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        Try
            Select Case m.Msg
                Case WM_NCLBUTTONDOWN
                    If m.WParam.ToInt32 = HTCAPTION Then
                        MsgBox("Titlebar clicked")
                        'here you can do your stuff
                    End If
            End Select
            MyBase.WndProc(m)

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        MyBase.WndProc(m)
    End Sub
Avatar of ommer
ommer

ASKER

How do you declare WM_NCLBUTTONDOWN and HTCAPTION?

and, I am talking about Toolbar, and you were refering to TitleBar... They all work the same?

Thank you for your reply!
ASKER CERTIFIED SOLUTION
Avatar of theGhost_k8
theGhost_k8
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ommer

ASKER

You are great!