共用方式為


CSplitButton::OnDropDown

Handles the BCN_DROPDOWN notification that the system sends when a user clicks the drop-down arrow of the current split button control.

afx_msg void OnDropDown(
    NMHDR* pNMHDR, 
    LRESULT* pResult
);

Parameters

Parameter

Description

[in] pNMHDR

Pointer to an NMHDR structure that contains information about the BCN_DROPDOWN notification.

[out] pResult

(Not used; no value is returned.) Return value of the BCN_DROPDOWN notification.

Requirements

Header: afxcmn.h

This method is supported in Windows Vista and later.

Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.

Remarks

When the user clicks the drop-down arrow on a split button control, system sends a BCN_DROPDOWN notification message, which the OnDropDown method handles. However, the CSplitButton object does not forward the BCN_DROPDOWN notification to the control that contains the split button control. Consequently, the containing control cannot support a custom action in response to the notification.

To implement a custom action that the containing control supports, use a CButton object with a style of BS_SPLITBUTTON instead of a CSplitButton object. Then implement a handler for the BCN_DROPDOWN notification in the CButton object. For more information, see Button Styles.

To implement a custom action that the split button control itself supports, use message reflection. Derive your own class from the CSplitButton class and name it, for example, CMySplitButton. Then add the following message map to your application to handle the BCN_DROPDOWN notification:

BEGIN_MESSAGE_MAP(CMySplitButton, CSplitButton)
   ON_NOTIFY_REFLECT(BCN_DROPDOWN, &CMySplitButton::OnDropDown)
END_MESSAGE_MAP()

See Also

Reference

CSplitButton Class

Hierarchy Chart

TN062: Message Reflection for Windows Controls

Button Styles

Other Resources

CSplitButton Members