Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ButtonState Enumeration
Collapse the table of content
Expand the table of content

ButtonState Enumeration

Specifies the appearance of a button.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

[Visual Basic]
Public Enum ButtonState
public enum ButtonState
__value public enum ButtonState
enum ButtonState


This enumeration represents the different states of a button. The default state is Normal.


Member name Description Value
All All flags except Normal are set. 18176
Checked The button has a checked or latched appearance. Use this appearance to show that a toggle button has been pressed. 1024
Flat The button has a flat, two-dimensional appearance. 16384
Inactive The button is inactive (grayed). 256
Normal The button has its normal appearance (three-dimensional). 0
Pushed The button appears pressed. 512


[Visual Basic, C#, C++] In this example, you use the ButtonState enumeration as a parameter to the method DrawButton to specify the state of button1. To run the example, create two buttons, button1 and button2. Then replace the button2_Click method with the example code. Click button2 to redraw button1 and change its state to Flat.

[Visual Basic] 
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

private void button2_Click(object sender, System.EventArgs e)
    // Draws a flat button on button1.

    void button2_Click(Object* /*sender*/, System::EventArgs* /*e*/) {
        // Draws a flat button on button1.
            0, 0, button1->Width, button1->Height, ButtonState::Flat);

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Windows.Forms

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Windows.Forms (in System.Windows.Forms.dll)

See Also

System.Windows.Forms Namespace | Graphics

© 2015 Microsoft