ButtonState Enum
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the appearance of a button.
This enumeration supports a bitwise combination of its member values.
public enum class ButtonState
[System.Flags]
public enum ButtonState
[<System.Flags>]
type ButtonState =
Public Enum ButtonState
- Inheritance
- Attributes
Name | Value | Description |
---|---|---|
Normal | 0 | The button has its normal appearance (three-dimensional). |
Inactive | 256 | The button is inactive (grayed). |
Pushed | 512 | The button appears pressed. |
Checked | 1024 | The button has a checked or latched appearance. Use this appearance to show that a toggle button has been pressed. |
Flat | 16384 | The button has a flat, two-dimensional appearance. |
All | 18176 | All flags except |
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
.
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.
ControlPaint.DrawButton(
System.Drawing.Graphics.FromHwnd(_button1.Handle), 0, 0,
_button1.Width, _button1.Height,
ButtonState.Flat);
}
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
This enumeration represents the different states of a button. The default state is Normal
.
Product | Versions |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: