Control.SkinID 属性

定义

获取或设置要应用于控件的外观。Gets or sets the skin to apply to the control.

public:
 virtual property System::String ^ SkinID { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Browsable(false)]
public virtual string SkinID { get; set; }
member this.SkinID : string with get, set
Public Overridable Property SkinID As String

属性值

要应用于控件外观的名称。The name of the skin to apply to the control. 默认值为 EmptyThe default is Empty.

属性

例外

已经应用了样式表。The style sheet has already been applied.

-or-

Page_PreInit 事件已发生。The Page_PreInit event has already occurred.

-or-

已将该控件添加到 Controls 集合中。The control was already added to the Controls collection.

注解

控件的可用外观包含在主题目录中的一个或多个外观文件中。Skins available to a control are contained in one or more skin files in a theme directory. SkinID 属性指定要应用于控件的外观。The SkinID property specifies which of these skins to apply to the control. 外观特定于特定控件;不能在不同类型的控件之间共享外观设置。A skin is specific to a particular control; you cannot share skin settings between controls of different types.

如果未设置 SkinID 属性,控件将使用默认的外观(如果已定义)。If you do not set the SkinID property, a control uses the default skin if one is defined. 例如,如果为 Image 控件定义了没有 ID 的外观,则该外观适用于所有未按 ID 显式引用外观且未设置为禁用主题的 Image 控件。For example, if a skin without an ID is defined for an Image control, then that skin applies to all Image controls that do not explicitly reference a skin by ID and that are not set to disable themes. 如果为 Image 控件定义了具有 ID 的外观,则该外观仅适用于其 SkinID 属性设置为该 ID 的 Image 控件。If a skin with an ID is defined for an Image control, then that skin applies only to Image controls whose SkinID property is set to that ID.

如果主题目录中的外观文件不包含具有指定 SkinID 属性的外观,则在运行时将引发 ArgumentException 异常。If the skin files in a theme directory do not contain a skin with the specified SkinID property, an ArgumentException exception is thrown at run time.

适用于

另请参阅