Click here to Skip to main content
15,898,134 members
Articles / Multimedia / GDI+

Rich Design Time Editing with UITypeEditors (VB.NET)

Rate me:
Please Sign up or sign in to vote.
4.98/5 (63 votes)
18 Jan 2012CPOL14 min read 168.5K   4.5K   170  
How to use UITypeEditors, Smart Tags, ControlDesigner Verbs, and Expandable Properties to make design-time editing easier.
Public Class Form1

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        PropertyGrid1.CollapseAllGridItems()

        ExpandGridItem("Appearance Shape", PropertyGrid1)

    End Sub

    ' Find the GridItem
    Private Sub ExpandGridItem(ByVal Search_grid_item As String, ByVal pg As PropertyGrid)
        ' Find the GridItem root.
        Dim root As Object
        root = pg.SelectedGridItem
        Do Until root.Parent Is Nothing
            root = root.Parent
        Loop

        ' Search the grid.
        Dim childgriditem As New Collection
        childgriditem.Add(root)
        Do Until childgriditem.Count = 0
            Dim test As GridItem = childgriditem(1)
            childgriditem.Remove(1)
            If test.Label = Search_grid_item Then test.Expanded = True

            For Each obj As Object In test.GridItems
                childgriditem.Add(obj)
            Next obj
        Loop
    End Sub

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United States United States
I first got hooked on programing with the TI994A. After it finally lost all support I reluctantly moved to the Apple IIe. Thank You BeagleBros for getting me through. I wrote programs for my Scuba buisness during this time. Currently I am a Database manager and software developer. I started with VBA and VB6 and now having fun with VB.NET/WPF/C#...

Comments and Discussions