Gets or sets the flat style appearance of the button control.
[Visual Basic] Public Property FlatStyle As FlatStyle [C#] public FlatStyle FlatStyle {get; set;} [C++] public: __property FlatStyle get_FlatStyle(); public: __property void set_FlatStyle(FlatStyle); [JScript] public function get FlatStyle() : FlatStyle; public function set FlatStyle(FlatStyle);
One of the FlatStyle values. The default value is Standard.
Exception Type | Condition |
---|---|
InvalidEnumArgumentException | The value assigned is not one of the FlatStyle values. |
The following example uses the derived class, Button and sets some of its common properties. The result will be a flat button with text on the left and an image on the right.
[Visual Basic]
Private Sub MySub() ' Create a new resource. Dim resources As System.Resources.ResourceManager = _ New System.Resources.ResourceManager("Form1", "") ' Get an image from a resource and assign it to the button. Button1.Image = Resources.GetObject("Button1.Image") ' Align the image to middle-right position on the button. Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleRight ' Make the button appear flat. Button1.FlatStyle = System.WinForms.FlatStyle.Flat ' Align the text to the middle-left position on the button. Button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft End Sub
ButtonBase Class | ButtonBase Members | System.WinForms Namespace