本文整理汇总了VB.NET中System.Web.UI.HtmlTextWriter.EnterStyle方法的典型用法代码示例。如果您正苦于以下问题:VB.NET HtmlTextWriter.EnterStyle方法的具体用法?VB.NET HtmlTextWriter.EnterStyle怎么用?VB.NET HtmlTextWriter.EnterStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.HtmlTextWriter
的用法示例。
在下文中一共展示了HtmlTextWriter.EnterStyle方法的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