Export (0) Print
Expand All
Expand Minimize

ButtonState Enumeration

Specifies the appearance of a button.

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

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

[FlagsAttribute]
public enum ButtonState

Member nameDescription
CheckedThe button has a checked or latched appearance. Use this appearance to show that a toggle button has been pressed.
FlatThe button has a flat, two-dimensional appearance.
InactiveThe button is inactive (grayed).
NormalThe button has its normal appearance (three-dimensional).
PushedThe button appears pressed.
AllAll flags except Normal are set.

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

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.


private 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);
}


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft