Hi there
Id like to know you create a property Group for forms and user controls. just like you would get for size, margin, padding etc
my aim (for now at least) is to be able have a borders property consisting of left, right, top,bottom. All values would be an Integer.
I could just create 4 single properties but id would much prefer to group them under like borders or something.
Ive had a bit of a look around and i think i have to create a class with the properties set within that class and then set the property on the object as that class.
any way ive tried all that and i can't get it to come out on my form properties at all, worse than that when i just added a new one to the form the properties window was blank and visual studio crashed :/
Even If I'm missing some fundamentally much easier way to achieve my goal of the borders, I'd still like to know how to do the property group as it'll probably come in handy
please note value are currently in boolean as that was the original idea but writing this i decided that integer would give me much more functionality in fact i might even go for palet color and default it to transparent or something who knows
any way here is my class
and my usageCode:Public Class ClsPnlBorders Private mRight As Boolean Public Property Right As Boolean Get Return mRight End Get Set(value As Boolean) mRight = value RaiseEvent BordersChanged() End Set End Property Private mLeft As Boolean Public Property Left As Boolean Get Return mLeft End Get Set(value As Boolean) mLeft = value RaiseEvent BordersChanged() End Set End Property Private mTop As Boolean Public Property Top As Boolean Get Return mTop End Get Set(value As Boolean) mTop = value RaiseEvent BordersChanged() End Set End Property Private mBottom As Boolean Public Property Bottom As Boolean Get Return mBottom End Get Set(value As Boolean) mBottom = value RaiseEvent BordersChanged() End Set End Property Public Sub New(right As Boolean, left As Boolean, top As Boolean, bottom As Boolean) mRight = right mLeft = left mTop = top mBottom = bottom End Sub Public Event BordersChanged() End Class
Code:Private mBorders() As ClsPnlBorders <TypeConverter(GetType(ExpandableObjectConverter)), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _ Public Property Borders() As ClsPnlBorders Get Return mBorders(0) End Get Set(value As ClsPnlBorders) mBorders(0) = value End Set End Property
many thanks
Ian




Reply With Quote