FlatStyle FlatStyle FlatStyle FlatStyle Enum

定义

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

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

字段

Flat Flat Flat Flat 0

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

Popup Popup Popup Popup 1

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

Standard Standard Standard Standard 2

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

System System System System 3

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

示例

下面是清单以允许应用程序以支持 Windows XP 中可用的可视样式,如果使用.NET Framework 1.0 版的一个示例。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. 清单文件驻留在与可执行文件相同的目录和文本文件的名称必须与其他文件名称扩展 of.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.exe 的清单文件将 MyApp.exe.manifest。For example, the manifest file for MyApp.exe would be MyApp.exe.manifest. 此示例假定FlatStyle在应用程序中控件的属性设置为系统。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">  
 <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>  

注解

此枚举如由成员ButtonBase.FlatStyleGroupBox.FlatStyle,和Label.FlatStyleThis 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. 当鼠标指针移动到 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.BackgroundImageImageAlignImageImageIndexImageList,并TextAlignIf 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.

备注

FlatStyle的属性RadioButtonCheckBox类设置为系统、 用户的操作系统来绘制控件和基于检查对齐方式CheckAlignButtonBase.TextAlign属性值。When 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控件,其CheckAlign属性值为System.Drawing.ContentAlignment和一个TextAlign属性值System.Drawing.ContentAlignment,和FlatStyle属性值设置为系统中,将显示为复选框对齐方式System.Drawing.ContentAlignment时的文本对齐方式将保持不变。For example, if you have a CheckBox control with a CheckAlign property value of System.Drawing.ContentAlignment and a TextAlign property value of System.Drawing.ContentAlignment, and the FlatStyle property value is set to System, the check box alignment will appear to be System.Drawing.ContentAlignment 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.

适用于

另请参阅