Search code examples
vb.netcustom-controls

Custom Properties Picturebox control


1st attempt at creating a control. i have a class, that Inherits PictureBox

here are some custom properties

    'Properties
<Category("Boarder"), Description("Border Size")>
Public Property BorderSize As Integer
    Get
        Return borderSizeField
    End Get
    Set(ByVal value As Integer)
        borderSizeField = value
        Invalidate()
    End Set
End Property


<Category("Boarder"), Description("Border Color")>
Public Property BorderColor As Color
    Get
        Return borderColorField
    End Get
    Set(ByVal value As Color)
        borderColorField = value
        Invalidate()
    End Set
End Property

<Category("Boarder"), Description("Border Color2")>
Public Property BorderColor2 As Color
    Get
        Return borderColor2Field
    End Get
    Set(ByVal value As Color)
        borderColor2Field = value
        Invalidate()
    End Set
End Property

If i select "Categorized" in the property grid of the control when i place it on the form, my properties are grouped together.

enter image description here

However, when i select "Alphabetized" they are not grouped.

Question: How can i have them grouped when "Alphabetized" is selected. Just like the Location is on the picturebox control

enter image description here


Solution

  • There is no grouping there. Location is one property and it's displayed in the property list in alphabetical order, just as your properties are. The Location property is type Point and the X and Y you're seeing there are properties of that Point value, not properties of the PictureBox. If you add your own property of type Point, you'll see the same thing.