The drop down button is clicked.
| C# | void object_DropDownClick(object sender, EventArgumentType e); |
| VB.NET | Private Sub object_DropDownClick(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.DropDownClick |
| C++ | void OnDropDownClickobject(); |
| C | HRESULT OnDropDownClickobject(); |
| VB | Private Sub object_DropDownClick() |
object
The DropDownClick event occurs when the drop down button is clicked or when the user presses Alt+Down Arrow. Depending on the DropDownDownClick property, the event occurs as the mouse button is pressed or released. Using properties such as the DropDownPressed property does not cause this event to occur.
If the user double-clicks the drop down button, the DropDownDblClick event also occurs.
The Click event occurs when the button is clicked.
} private void axSftButton1_ClickEvent(object sender, System.EventArgs e) { // Invoke the default action, because the button was clicked menuItem1_Click(axSftButton1, new System.EventArgs()); } private void axSftButton1_DropDownClick(object sender, System.EventArgs e) { // The drop down button was clicked. Display a popup menu // right-aligned with the right edge of the button Point pt = new Point(axSftButton1.Location.X + axSftButton1.Size.Width, axSftButton1.Location.Y + axSftButton1.Size.Height); pt = PointToScreen(pt); axSftButton1.CancelMode();
menuItem1_Click(AxSftButton1, New System.EventArgs)
End Sub
Private Sub AxSftButton5_ClickEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftButton5.ClickEvent
' Invoke the default action, because the button was clicked
menuItem1_Click(AxSftButton1, New System.EventArgs)
End Sub
Private Sub AxSftButton1_DropDownClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxSftButton1.DropDownClick
' The drop down button was clicked. Display a popup menu
' right-aligned with the right edge of the button
Dim pt As Point = New Point(AxSftButton1.Location.X + AxSftButton1.Size.Width, _
AxSftButton1.Location.Y + AxSftButton1.Size.Height)
pt = PointToScreen(pt)
AxSftButton1.CancelMode()
TrackPopupMenu(ContextMenu1.Handle, Convert.ToUInt32(TPM_RIGHTALIGN Or TPM_TOPALIGN Or TPM_LEFTBUTTON), pt.X, pt.Y, 0, Me.Handle, IntPtr.Zero)} void CPopupDlg::OnClickSftbtn1() { // Invoke the default action, because the button was clicked SendMessage(WM_COMMAND, IDM_DEFAULTACTION); } void CPopupDlg::OnDropDownClickSftbtn1() { // The drop down button was clicked. Display a popup menu // right-aligned with the right edge of the button RECT rect; m_Button1.GetWindowRect(&rect); // get button position m_Button1.SendMessage(WM_CANCELMODE);// required before invoking popup menu ShowMenu(rect.right, rect.bottom); // display the menu
End With
End Sub
Private Sub SftButton1_Click()
' Invoke the default action, because the button was clicked
Call Form2.popupMenu_DefaultAction_Click
End Sub
Private Sub SftButton1_DropDownClick()
' The drop down button was clicked. Display a popup menu
' right-aligned with the right edge of the button
Dim x As Single, y As Single
With SftButton1
x = .Left + .Width
y = .Top + .Height
PopupMenu Form2.mainMenu, vbPopupMenuRightAlign, x, y, Form2.popupMenu_DefaultActionSee Also SftButton Object | Object Hierarchy