共用方式為


CButton::SetDropDownState

Sets the drop-down state of the current split button control.

BOOL SetDropDownState(
     BOOL fDropDown
);

Parameters

Parameter

Description

[in] fDropDown

true to set BST_DROPDOWNPUSHED state; otherwise, false.

Return Value

true if this method is successful; otherwise, false.

Remarks

A split button control has a style of BS_SPLITBUTTON or BS_DEFSPLITBUTTON and consists of a button and a drop-down arrow to its right. For more information, see Button Styles. Usually, the drop-down state is set when the user clicks the drop-down arrow. Use this method to programmatically set the drop-down state of the control. The drop-down arrow is drawn shaded to indicate the state.

This method sends the BCM_SETDROPDOWNSTATE message, which is described in the Windows SDK.

Requirements

Header: afxwin.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.

Example

The following code example defines the variable, m_splitButton, that is used to programmatically access the split button control. This variable is used in the following example.

public:
    // Variable to access programatically defined command link control.
    CButton m_cmdLink;
    // Variable to access programatically defined split button control. 
    CButton m_splitButton;

The following code example sets the state of the split button control to indicate that the drop-down arrow is pushed.

/* Set the state of the split button control to indicate that 
    the drop-down arrow is pushed. The arrow is drawn shaded to 
    indicate the state.
    */
    m_splitButton.SetDropDownState( TRUE );

See Also

Reference

CButton Class

Hierarchy Chart

BCM_SETDROPDOWNSTATE