Compartilhar via


CButton::SetSplitStyle

Sets the style of the current split button control.

BOOL SetSplitStyle(
     UINT uSplitStyle
);

Parameters

Parameter

Description

[in] uSplitStyle

A bitwise combination of split button styles. For more information, see the uSplitStyle member of the BUTTON_SPLITINFO structure.

Return Value

true if this method is successful; otherwise, false.

Remarks

Use this method only with controls whose button style is BS_SPLITBUTTON or BS_DEFSPLITBUTTON.

The split button styles specify the alignment, aspect ratio, and graphical format with which Windows draws a split button icon. For more information, see the uSplitStyle member of the BUTTON_SPLITINFO structure.

This method initializes the mask member of a BUTTON_SPLITINFO structure with the BCSIF_STYLE flag and the uSplitStyle member with the uSplitStyle parameter, and then sends that structure in the BCM_GETSPLITINFO message that 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.

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 style of the split button drop-down arrow. The BCSS_ALIGNLEFT style displays the arrow on the left side of the button, and the BCSS_STRETCH style retains the drop-down arrow's proportions when you resize the button.

/* 
    Set the style of the split button drop-down arrow: Display the 
    arrow on the left and retain the arrow's proportions when resizing 
    the control.
    */
    bRC = m_splitButton.SetSplitStyle( BCSS_ALIGNLEFT | BCSS_STRETCH );

See Also

Reference

CButton Class

Hierarchy Chart

CButton::GetSplitStyle

CButton::GetSplitInfo

BCM_SETSPLITINFO