當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET HierarchicalDataBoundControlDesigner類代碼示例

本文整理匯總了VB.NET中System.Web.UI.Design.WebControls.HierarchicalDataBoundControlDesigner的典型用法代碼示例。如果您正苦於以下問題:VB.NET HierarchicalDataBoundControlDesigner類的具體用法?VB.NET HierarchicalDataBoundControlDesigner怎麽用?VB.NET HierarchicalDataBoundControlDesigner使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了HierarchicalDataBoundControlDesigner類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: PreFilterProperties

' 導入命名空間
Imports System.IO
Imports System.Web
Imports System.Drawing
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design.WebControls
Imports System.Collections
Imports System.ComponentModel
Imports System.Security.Permissions

Namespace Examples.VB.WebControls.Design

    ' The MyHierarchicalDataBoundControl is a copy of the 
    ' HierarchicalDataBoundControl.
    <AspNetHostingPermission(SecurityAction.Demand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    <Designer(GetType(Examples.VB.WebControls.Design. _
        MyHierarchicalDataBoundControlDesigner))> _
    Public Class MyHierarchicalDataBoundControl
        Inherits HierarchicalDataBoundControl
    End Class

    ' Override members of the HierarchicalDataBoundControlDesigner.
    <ReflectionPermission(SecurityAction.Demand, Flags:=ReflectionPermissionFlag.MemberAccess)> _
    Public Class MyHierarchicalDataBoundControlDesigner
        Inherits HierarchicalDataBoundControlDesigner

        Private Const bracketClose As String = ">"
        Private Const spanOpen As String = "<SPAN"
        Private Const spanClose As String = "</SPAN>"

        ' Return the markup for a placeholder, if the inner markup is empty.
        ' For brevity, the code that is used to detect embedded white_space 
        ' in the tags is not shown.
        Public Overrides Function GetDesignTimeHtml() As String

            ' Get the design-time markup from the base method.
            Dim markup As String = MyBase.GetDesignTimeHtml()

            ' If the markup is null or empty, return the markup 
            ' for the placeholder.
            If String.IsNullOrEmpty(markup) Then
                Return GetEmptyDesignTimeHtml()
            End If

            ' Make the markup uniform case so that the IndexOf will work.
            Dim markupUC As String = markup.ToUpper()
            Dim charX As Integer

            ' Look for a <span ...> tag.
            charX = markupUC.IndexOf(spanOpen)
            If charX >= 0 Then

                ' Find closing bracket of span open tag.
                charX = markupUC.IndexOf(bracketClose, charX + spanOpen.Length)
                If charX >= 0 Then

                    ' If the inner markup of <span ...></span> is empty, 
                    ' return the markup for a placeholder.
                    If String.Compare(markupUC, charX + 1, _
                        spanClose, 0, spanClose.Length) = 0 Then

                        Return GetEmptyDesignTimeHtml()
                    End If
                End If
            End If

            ' Return the original markup, if the inner markup is not empty.
            Return markup
        End Function ' GetDesignTimeHtml

        ' Shadow the control properties with design-time properties.
        Protected Overrides Sub PreFilterProperties( _
            ByVal properties As IDictionary)

            Dim namingContainer As String = "NamingContainer"

            ' Call the base method first.
            MyBase.PreFilterProperties(properties)

            ' Make the NamingContainery visible in the Properties grid.
            Dim selectProp As PropertyDescriptor = _
                CType(properties(namingContainer), PropertyDescriptor)
            properties(namingContainer) = _
                TypeDescriptor.CreateProperty(selectProp.ComponentType, _
                    selectProp, BrowsableAttribute.Yes)
        End Sub
    End Class
End Namespace ' Examples.VB.WebControls.Design
開發者ID:VB.NET開發者,項目名稱:System.Web.UI.Design.WebControls,代碼行數:91,代碼來源:HierarchicalDataBoundControlDesigner


注:本文中的System.Web.UI.Design.WebControls.HierarchicalDataBoundControlDesigner類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。