FlatStyle 枚举


指定控件的外观。Specifies the appearance of a control.

public enum class FlatStyle
public enum FlatStyle
type FlatStyle = 
Public Enum FlatStyle


Flat 0

该控件以平面显示。The control appears flat.

Popup 1

该控件以平面显示,直到鼠标指针移动到该控件为止,此时该控件外观为三维。A control appears flat until the mouse pointer moves over it, at which point it appears three-dimensional.

Standard 2

该控件外观为三维。The control appears three-dimensional.

System 3

该控件的外观是由用户的操作系统决定的。The appearance of the control is determined by the user's operating system.


下面是一个清单的示例, 如果你使用的是 .NET Framework 版本 1.0, 则允许你的应用程序支持 Windows XP 中可用的视觉样式。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. 清单文件与可执行文件位于同一目录中, 并且文本文件的名称必须是文件扩展名为 .manifest 的可执行文件的完整名称。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. 例如, MyApp 的清单文件将是 MyApp。For example, the manifest file for MyApp.exe would be MyApp.exe.manifest. 此示例假定FlatStyle应用程序中控件的属性设置为 System。This example assumes that the FlatStyle properties of the controls in your application are set to System.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>  
 <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">  
 <description>Your application description here.</description>  


此枚举由ButtonBase.FlatStyleGroupBox.FlatStyleLabel.FlatStyle等成员使用。This enumeration is used by members such as ButtonBase.FlatStyle, GroupBox.FlatStyle, and Label.FlatStyle.

对于 Popup 样式按钮, 此枚举控制某些行为和外观。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. 当鼠标指针移到 Popup 控件上时, 它将显示为标准样式控件, 直到鼠标指针再次移出它。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.

如果使用系统样式, 则控件的外观由用户的操作系统确定, 以下属性值将被忽略: Control.BackgroundImageImageAlignImageImageIndexImageListTextAlignIf 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. 此外, 按钮控件Control.BackColor的属性将被忽略。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.


RadioButton System当和CheckAlign ButtonBase.TextAlign类的FlatStyle属性设置为时, 控件由用户的操作系统绘制, 并且检查对齐方式取决于和属性值。 CheckBoxWhen the FlatStyle property of the RadioButton and CheckBox classes is set to 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. CheckAlign属性值不会更改, 但控件的外观可能会受到影响。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. 例如, CheckBox如果您的控件CheckAlignTextAlign属性值为ContentAlignment.MiddleCenter ContentAlignment.TopRight, 属性值为, 且FlatStyle属性值设置为System, 则复选框对齐将显示为ContentAlignment.TopLeft文本对齐方式保持不变。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 System, the check box alignment will appear to be ContentAlignment.TopLeft while the text alignment remains unchanged.


如果需要FlatStyle在控件上显示图像、将图像显示为控件的背景或执行精确的文本对齐, 则不建议将属性设置为 "系统"。Setting the FlatStyle property to 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.