HtmlTextWriter.RegisterStyle(String, HtmlTextWriterStyle) 方法

定義

從原始程式檔登錄標記樣式屬性 (不論是常值或動態產生),讓屬性可以適當地在提出要求的用戶端呈現。Registers markup style properties, whether literals or dynamically generated, from the source file so that they can be properly rendered to the requesting client.

protected:
 static void RegisterStyle(System::String ^ name, System::Web::UI::HtmlTextWriterStyle key);
protected static void RegisterStyle (string name, System.Web.UI.HtmlTextWriterStyle key);
static member RegisterStyle : string * System.Web.UI.HtmlTextWriterStyle -> unit
Protected Shared Sub RegisterStyle (name As String, key As HtmlTextWriterStyle)

參數

name
String

從原始程式檔傳遞來的指定樣式名稱的字串。The string passed from the source file specifying the style name.

key
HtmlTextWriterStyle

與指定樣式對應的 HtmlTextWriterStyleThe HtmlTextWriterStyle that corresponds with the specified style.

備註

在建立第一個RegisterStyle HtmlTextWriter物件時,會透過呼叫方法來註冊 HTML 標籤語言的預先定義級聯樣式表(CSS)屬性。The predefined cascading style sheet (CSS) attributes of the HTML markup language are registered by calls to the RegisterStyle method when the first HtmlTextWriter object is created. 動態樣式屬性可以在其他時間使用RegisterStyle方法進行註冊。Dynamic style attributes can be registered by using the RegisterStyle method at other times.

RegisterStyle方法所使用的註冊表是, static因此屬性的註冊會套用至主HtmlTextWriter電腦上的所有物件。The registration table used by the RegisterStyle method is static, so registration of attributes applies to all HtmlTextWriter objects on the host computer.

適用於

另請參閱