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 创建第一个对象时,会通过对方法的调用来注册预定义的级联样式表 (CSS) 特性 HtmlTextWriterThe 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.

方法使用的注册表 RegisterStylestatic ,因此属性的注册将应用于 HtmlTextWriter 主计算机上的所有对象。The registration table used by the RegisterStyle method is static, so registration of attributes applies to all HtmlTextWriter objects on the host computer.

适用于

另请参阅