Reputation: 927
I declared a custom property "Padding"
Public Overloads Property Padding() As Padding
Get
Return (pad)
End Get
Set(ByVal Value As Padding)
pad = Value
RecalculateCharacterSize()
Me.Refresh()
End Set
End Property
and works at design time. But when I run the form, this property is reset to 0 and when come back in design editor is also zero. There is a conflict with originally "Padding" property name because if I change to "Padding2" works fine (and I can change my name) but the originally name fits best :)
Thanks very much for suggestions, I'm sure there is something stupid here
PS. I decored with those but still nothing works
<EditorBrowsable(EditorBrowsableState.Always), Browsable(True), Bindable(True), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
any thoughts ?
Upvotes: 1
Views: 1046
Reputation: 927
Thanks very much Mark, works :)
Public Shadows Property Padding() As Padding
Get
Return (pad)
End Get
Set(ByVal Value As Padding)
pad = Value
MyBase.Padding = pad ' ---> this had to be added
RecalculateCharacterSize()
Me.Refresh()
End Set
End Property
Upvotes: 1
Reputation: 54532
If you are just trying to add to the existing Padding
Property try something like this.
Public Shadows Property Padding() As Padding
Get
Return (MyBase.Padding)
End Get
Set(ByVal Value As Padding)
MyBase.Padding = Value
pad = Value
RecalculateCharacterSize()
Me.Refresh()
End Set
End Property
Upvotes: 0