共用方式為


CMFCButton::m_nFlatStyle

Specifies the style of the button, such as borderless, flat, semi-flat, or 3D.

FlatStyle  m_nFlatStyle;

Remarks

The following table lists the CMFCButton::m_nFlatStyle enumeration values that specify the appearance of a button.

Value

Description

BUTTONSTYLE_3D

(Default) The button appears to have high, three-dimensional sides. When the button is clicked, the button appears to be pressed into a deep indentation.

BUTTONSTYLE_FLAT

When the mouse does not pause over the button, the button appears to be two-dimensional and does not have raised sides. When the mouse pauses over the button, the button appears to have low, three-dimensional sides. When the button is clicked, the button appears to be pressed into a shallow indentation.

BUTTONSTYLE_SEMIFLAT

The button appears to have low, three-dimensional sides. When the button is clicked, the button appears to be pressed into a deep indentation.

BUTTONSTYLE_NOBORDERS

The button does not have raised sides and always appears two-dimensional. The button does not appear to be pressed into an indentation when it is clicked.

The CMFCButton constructor initializes this member to BUTTONSTYLE_3D.

Example

The following example demonstrates how to set the values of the m_nFlatStyle member variable in the CMFCButton class. This example is part of the New Controls sample.

    CMFCButton m_Button;


...


    //int m_iBorderStyle
    switch (m_iBorderStyle)
    {
    case 0:
        m_Button.m_nFlatStyle = CMFCButton::BUTTONSTYLE_FLAT;
        break;

    case 1:
        m_Button.m_nFlatStyle = CMFCButton::BUTTONSTYLE_SEMIFLAT;
        break;

    case 2:
        m_Button.m_nFlatStyle = CMFCButton::BUTTONSTYLE_3D;
    }

Requirements

Header: afxbutton.h

See Also

Reference

CMFCButton Class

Hierarchy Chart