This documentation is archived and is not being maintained.

Label.FlatStyle Property

Gets or sets the flat style appearance of the label control.

[Visual Basic]
Public Property FlatStyle As FlatStyle
public FlatStyle FlatStyle {get; set;}
public: __property FlatStyle get_FlatStyle();
public: __property void set_FlatStyle(FlatStyle);
public function get FlatStyle() : FlatStyle;
public function set FlatStyle(FlatStyle);

Property Value

One of the FlatStyle values. The default value is Standard.


Exception Type Condition
InvalidEnumArgumentException The value assigned is not one of the FlatStyle values.


When the FlatStyle property is set to FlatStyle.System, any values assigned to the ImageList, Image, ImageIndex, and ImageAlign properties are ignored. In addition, the TextAlign property ignores any property values that are not vertical property settings. Horizontally aligned settings of the TextAlign property are aligned to the top of the control. For example, if you set the TextAlign property to ContentAlignment.TopCenter, ContentAlignment.MiddleCenter, or ContentAlignment.BottomCenter, when the FlatStyle property is set to FlatStyle.System, the text in the Label control will be aligned to the top and center locations within the bounds of the control.

Note   In version 1.1 of the .NET Framework, setting the FlatStyle property to FlatStyle.System does not cause the value of the TextAlign property to be ignored.
Note   This property has no effect in the derived class, LinkLabel.


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

See Also

Label Class | Label Members | System.Windows.Forms Namespace