当前位置: 首页>>代码示例>>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;未经允许,请勿转载。