本文整理匯總了VB.NET中System.Web.UI.HtmlTextWriter.ExitStyle方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET HtmlTextWriter.ExitStyle方法的具體用法?VB.NET HtmlTextWriter.ExitStyle怎麽用?VB.NET HtmlTextWriter.ExitStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Web.UI.HtmlTextWriter
的用法示例。
在下文中一共展示了HtmlTextWriter.ExitStyle方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Render
' 導入命名空間
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Security.Permissions
Imports System.Drawing
' Create a custom class, named TextSample, that renders
' its Text property with styles applied by the
' EnterStyle and ExitStyle methods.
Namespace AspNet.Samples
<AspNetHostingPermission(SecurityAction.Demand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermission(SecurityAction.InheritanceDemand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class TextSample
Inherits Control
' Create an instance of the Style class.
Private textStyle As Style = New Style()
Private textMessage As String
' Create a Text property.
Public Property Text() As String
Get
Return textMessage
End Get
Set(ByVal value As String)
textMessage = value
End Set
End Property
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
' Set the value of the Text property.
textMessage = "Hello, World!"
' Set the Style object's ForeColor
' property to Navy.
textStyle.ForeColor = Color.Navy
' Render the Text property with the style.
writer.WriteLine("The text property styled: ")
writer.EnterStyle(textStyle)
writer.Write(Text)
writer.ExitStyle(textStyle)
' Use the WriteBreak method twice to render
' an empty line between the lines of rendered text.
writer.WriteBreak()
writer.WriteBreak()
' Render the Text property without the style.
writer.WriteLine("The Text property unstyled: ")
writer.Write(Text)
End Sub
End Class
End Namespace