Control.EnableTheming 屬性


取得或設定值,指出佈景主題是否套用至此控制項。Gets or sets a value indicating whether themes apply to this control.

 virtual property bool EnableTheming { bool get(); void set(bool value); };
public virtual bool EnableTheming { get; set; }
member this.EnableTheming : bool with get, set
Public Overridable Property EnableTheming As Boolean


true 表示使用主題,否則為 falsetrue to use themes; otherwise, false. 預設值為 trueThe default is true.



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


控制項已加入至 Controls 集合。The control has already been added to the Controls collection.


EnableTheming 屬性會指出是否已針對指定的控制項啟用主題。The EnableTheming property indicates whether themes are enabled for a specified control. trueEnableTheming 屬性時,會在應用程式的主題目錄中搜尋要套用的控制面板。When the EnableTheming property is true, the application's theme directory is searched for control skins to apply. 如果主題目錄中沒有特定控制項的面板,則不會套用任何外觀。If no skin for the particular control exists in the theme directory, skins are not applied.

falseEnableTheming 屬性時,不會搜尋主題目錄,也不會使用 SkinID 屬性的內容。When the EnableTheming property is false, the theme directory is not searched and the content of the SkinID property is not used.

您可以在頁面、容器或控制項層級啟用主題。Themes can be enabled at the page, container, or control level. 控制項可以覆寫其父控制項或包含頁面所設定的 EnableTheming 值。A control can override the EnableTheming value set by its parent control, or by the containing page.