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

控制項顯示為平面直到滑鼠指標移至其上,此時控制項為 3D 顯示。A control appears flat until the mouse pointer moves over it, at which point it appears three-dimensional.

Standard 2

控制項為 3D 顯示。The control appears three-dimensional.

System 3

控制項的外觀是由使用者的作業系統決定。The appearance of the control is determined by the user's operating system.


以下是資訊清單的範例,可讓您的應用程式支援 Windows XP 中提供的視覺化樣式(如果您使用1.0 版的 .NET Framework)。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.exe 的資訊清單檔會是 MyApp.exe 資訊清單。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.FlatStyle GroupBox.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.BackgroundImage 、、、、 ImageAlign Image ImageIndex ImageListTextAlignIf 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 和類別的屬性 RadioButton CheckBox 設定為時 System ,控制項會由使用者的作業系統繪製,而檢查對齊是以 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 ContentAlignment.MiddleCenter TextAlign 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.