ButtonState ButtonState ButtonState ButtonState Enum


指定按钮的外观。Specifies the appearance of a button.

此枚举有一个 FlagsAttribute 属性,允许按位组合成员值。

public enum class ButtonState
public enum ButtonState
type ButtonState = 
Public Enum ButtonState


All All All All 18176

设置除 Normal 以外的所有标志。All flags except Normal are set.

Checked Checked Checked Checked 1024

该按钮具有选中的或锁存的外观。The button has a checked or latched appearance. 使用此外观可显示已按下切换按钮。Use this appearance to show that a toggle button has been pressed.

Flat Flat Flat Flat 16384

该按钮具有平面的二维外观。The button has a flat, two-dimensional appearance.

Inactive Inactive Inactive Inactive 256

该按钮处于非活动状态(已变灰)。The button is inactive (grayed).

Normal Normal Normal Normal 0

该按钮具有正常的外观(三维)。The button has its normal appearance (three-dimensional).

Pushed Pushed Pushed Pushed 512

该按钮处于按下状态。The button appears pressed.


在此示例中,使用ButtonState枚举作为方法的参数DrawButton指定的状态button1In this example, you use the ButtonState enumeration as a parameter to the method DrawButton to specify the state of button1. 若要运行示例,请创建两个按钮button1button2To run the example, create two buttons, button1 and button2. 然后,替换button2_Click方法的示例代码。Then replace the button2_Click method with the example code. 单击button2重绘button1并更改其状态为FlatClick button2 to redraw button1 and change its state to Flat.

void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   // Draws a flat button on button1.
   ControlPaint::DrawButton( System::Drawing::Graphics::FromHwnd( button1->Handle ), 0, 0, button1->Width, button1->Height, ButtonState::Flat );

private void Button2_Click(object sender, System.EventArgs e)
    // Draws a flat button on button1.
        System.Drawing.Graphics.FromHwnd(_button1.Handle), 0, 0, 
        _button1.Width, _button1.Height,

Private Sub button2_Click(sender As Object, e As System.EventArgs)
    ' Draws a flat button on button1.
    ControlPaint.DrawButton(System.Drawing.Graphics.FromHwnd(button1.Handle), 0, 0, button1.Width, button1.Height, ButtonState.Flat)
End Sub 'button2_Click


此枚举表示一个按钮的不同状态。This enumeration represents the different states of a button. 默认状态是NormalThe default state is Normal.