Control.SkinID 屬性


取得或設定要套用至控制項的面板。Gets or sets the skin to apply to the control.

 virtual property System::String ^ SkinID { System::String ^ get(); void set(System::String ^ value); };
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 控制項定義具有識別碼的面板,則該面板會套用至未明確參考面板的所有 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 控制項定義具有識別碼的面板,則該面板只會套用至其 SkinID 屬性設定為該識別碼的 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.