Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

FlatStyle Enumeration

Specifies the appearance of a control.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public enum FlatStyle
public enum FlatStyle
public enum FlatStyle
 Member nameDescription
FlatThe control appears flat. 
PopupA control appears flat until the mouse pointer moves over it, at which point it appears three-dimensional. 
StandardThe control appears three-dimensional. 
SystemThe appearance of the control is determined by the user's operating system. 

This enumeration is used by members such as ButtonBase.FlatStyle, GroupBox.FlatStyle, and Label.FlatStyle.

In the case of the Popup style button, this enumeration controls some behavior as well as appearance. The Popup style control initially appears Flat until the mouse pointer moves over it. When the mouse pointer moves over the Popup control, it appears as a Standard style control until the mouse pointer is moved off of it again.

If the System style is used, the appearance of the control is determined by the user's operating system and the following property values will be ignored: Control.BackgroundImage, ImageAlign, Image, ImageIndex, ImageList, and TextAlign. In addition, the Control.BackColor property will be ignored for button controls. If supported, users can change the appearance of controls by adjusting the appearance settings of their operating system.

NoteNote:

When the FlatStyle property of the RadioButton and CheckBox classes is set to FlatStyle.System, the control is drawn by the user's operating system and the check alignment is based upon the CheckAlign and ButtonBase.TextAlign property values. The CheckAlign property value is not changed, but the appearance of the control can be affected. The check box is horizontally aligned with either the left or right edge of the control (a left or center alignment appears left aligned, right remains unchanged), and vertically aligned the same as the descriptive text. For example, if you have a CheckBox control with a CheckAlign property value of ContentAlignment.MiddleCenter and a TextAlign property value of ContentAlignment.TopRight, and the FlatStyle property value is set to FlatStyle.System, the check box alignment will appear to be ContentAlignment.TopLeft while the text alignment remains unchanged.

Caution noteCaution:

Setting the FlatStyle property to FlatStyle.System is not advisable if you need to display an image on a control, display an image as a control's background, or perform precise text alignment.

Windows XP Home Edition, Windows XP Professional x64 Edition, Windows Server 2003 Platform Note: To make your Windows Forms application support Windows XP visual styles, be sure to set the FlatStyle property to FlatStyle.System. If you are using version 1.0 of the .NET Framework, include a manifest with your executable. A manifest is an XML file that is included either as a resource within your application executable or as a separate file that resides in the same directory as the executable file. For an example of a manifest, see the Example section. For more information about using the visual styles available in Windows XP, see the topic "Using Windows XP Visual Styles" in the "User Interface Design and Development" section of the MSDN Library.

The following is an example of a manifest to allow your application to support the visual styles available in Windows XP if you are using version 1.0 of the .NET Framework. The manifest can be added to your application as a resource or as a stand-alone text file. The manifest file resides in the same directory as the executable file, and the name of the text file must be the complete name of the executable file with an additional file name extension of.manifest. For example, the manifest file for MyApp.exe would be MyApp.exe.manifest. This example assumes that the FlatStyle properties of the controls in your application are set to FlatStyle.System.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
 <assemblyIdentity
     version="1.0.0.0"
     processorArchitecture="X86"
     name="CompanyName.ProductName.YourApplication"
     type="win32"
 />
 <description>Your application description here.</description>
 <dependency>
     <dependentAssembly>
         <assemblyIdentity
             type="win32"
             name="Microsoft.Windows.Common-Controls"
             version="6.0.0.0"
             processorArchitecture="X86"
             publicKeyToken="6595b64144ccf1df"
             language="*"
         />
     </dependentAssembly>
 </dependency>
 </assembly>

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.