Windows Forms designer sample demoed in VB (VBWinFormDesigner)

The code sample demonstrates various typical programming scenarios in Windows Forms Designer

VB.NET (85.1 KB)
4 Star
17,181 times
Add to favorites
E-mail Twitter Digg Facebook
       WINDOWS FORMS APPLICATION : VBWinFormDesigner Project Overview
                   CustomPropertyTab Sample


The CustomPropertyTab sample demonstrates how to add custom PropertyTab on to the 
Properties Windows 


1. Create a UserControl;

2. Add a reference to the System.Designer.dll;

3. Create an attribute derive from CustomTabDisplayAttribute class with a 
   property of bool type, name it with anything you like, for example:

4. Create a custom property tab class derive from PropertiesTab class;

5. Override the PropertiesTab.CanExtend property to make it only accepts our 
   user control type "UC_CumstomPropertyTab";
6. Override the PropertiesTab.GetProperties method to return the properties 
   that are marked as Browserable(false) and CustomTabDisplay(true);

7. Override the PropertiesTab.TabName property to give the custom properties 
   tab a name;
8. Create some properties in the UserControl, mark the properties you want to
   display on the custom properties tab with Browserable(false) and 
   CustomTabDisplay(true), e.g.
		 ' display on the custom tab
        <CustomTabDisplayAttribute(True), Browsable(False)> _
        Public Property TestProp() As String
                Return Me._testProp
            End Get
            Set(ByVal value As String)
                Me._testProp = value
            End Set
        End Property       
9. Mark the UserControl with Designer attribute to make it use the custom 
   control designer service created by above steps:
    <PropertyTab(GetType(CustomTab), PropertyTabScope.Component)> _
    Partial Public Class UC_CustomPropertyTab
        Inherits UserControl
    End Class
10. Create a bitmap file, name it with the same name as the type of custom 
    properties tab, in this sample, the name of the bitmap file should be

11. Draw something on the bitmap file;

12. Select the bitmap file in the solution explorer, and switch to the Properties
    Windows, choose "Embedded Resource" from the "Build Action" list;
13. Build the project.

14. Now the UserControl is available on the toolbox for use.


1. How do I add a custom tab to the property grid when it is displaying my object's properties?

2. Windows Forms FAQs