本文整理匯總了VB.NET中System.Web.UI.Design.WebControls.LabelDesigner類的典型用法代碼示例。如果您正苦於以下問題:VB.NET LabelDesigner類的具體用法?VB.NET LabelDesigner怎麽用?VB.NET LabelDesigner使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了LabelDesigner類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: GetDesignTimeHtml
' 導入命名空間
Imports System.Web
Imports System.ComponentModel
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design.WebControls
Imports System.Security.Permissions
Namespace Examples.VB.WebControls.Design
' The SampleLabel is a copy of the Label.
<AspNetHostingPermission(SecurityAction.Demand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermission(SecurityAction.InheritanceDemand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
<Designer(GetType(Examples.VB.WebControls.Design.SampleLabelDesigner))> _
Public Class SampleLabel
Inherits Label
End Class
' Override members of the LabelDesigner.
Public Class SampleLabelDesigner
Inherits LabelDesigner
' Generate the design-time markup.
Public Overrides Function GetDesignTimeHtml() As String
' Make the control more visible in the designer. If the border
' style is None or NotSet, change the border to a dashed line.
Dim sampleLabel As SampleLabel = CType(Component, SampleLabel)
Dim designTimeMarkup As String = Nothing
' Check if the border style should be changed.
If (sampleLabel.BorderStyle = BorderStyle.NotSet Or _
sampleLabel.BorderStyle = BorderStyle.None) Then
Dim oldBorderStyle As BorderStyle = sampleLabel.BorderStyle
Try
' Set the design-time BorderStyle.
sampleLabel.BorderStyle = BorderStyle.Dashed
' Call the base method to generate the markup.
designTimeMarkup = MyBase.GetDesignTimeHtml()
Catch ex As Exception
' If an exception occurs, generate an error message.
designTimeMarkup = GetErrorDesignTimeHtml(ex)
Finally
' Restore the BorderStyle to its original setting.
sampleLabel.BorderStyle = oldBorderStyle
End Try
Else
' Call the base method to generate the markup.
designTimeMarkup = MyBase.GetDesignTimeHtml()
End If
Return designTimeMarkup
End Function ' GetDesignTimeHtml
End Class
End Namespace ' Examples.VB.WebControls.Design