Label.FlatStyle 属性

定义

获取或设置标签控件的平面样式外观。Gets or sets the flat style appearance of the label control.

public:
 property System::Windows::Forms::FlatStyle FlatStyle { System::Windows::Forms::FlatStyle get(); void set(System::Windows::Forms::FlatStyle value); };
public System.Windows.Forms.FlatStyle FlatStyle { get; set; }
member this.FlatStyle : System.Windows.Forms.FlatStyle with get, set
Public Property FlatStyle As FlatStyle

属性值

FlatStyle

FlatStyle 值之一。One of the FlatStyle values. 默认值为 StandardThe default value is Standard.

例外

分配的值不是 FlatStyle 值之一。The value assigned is not one of the FlatStyle values.

注解

FlatStyle 属性设置为时 FlatStyle.System ,将忽略分配给、、 ImageList Image ImageIndexImageAlign 属性的任何值。When the FlatStyle property is set to FlatStyle.System, any values assigned to the ImageList, Image, ImageIndex, and ImageAlign properties are ignored. 此外,该 TextAlign 属性将忽略不是垂直属性设置的任何属性值。In addition, the TextAlign property ignores any property values that are not vertical property settings. 属性的水平对齐设置 TextAlign 与控件的顶部对齐。Horizontally aligned settings of the TextAlign property are aligned to the top of the control. 例如,如果将 TextAlign 属性设置为 ContentAlignment.TopCenterContentAlignment.MiddleCenter 或,则 ContentAlignment.BottomCenterFlatStyle 属性设置为时, FlatStyle.System 控件中的文本 Label 将与控件边界内的顶部和中心位置对齐。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.

备注

在 .NET Framework 版本1.1 中,将属性设置为不会 FlatStyle FlatStyle.System 导致忽略属性的值 TextAlignIn the .NET Framework version 1.1, setting the FlatStyle property to FlatStyle.System does not cause the value of the TextAlign property to be ignored. 此外,属性在派生类中不起作用 LinkLabelIn addition, the property has no effect in the derived class, LinkLabel.

适用于