making an ambient property

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, i want to make an ambient property for my control.

i have the ambient part working just fine , but in order to make this work
correctly in designtime i need to be able to set the "DefaultValue" of the
property dynamicly (not via [defaultvalue] attrib)


i mean , when placing a control on a form , the control get the same color
as the parent control , and the color is "defaulted"/"unchanged" it shows up
in the propbrowser as unchanged (not bold) and it does not persist to the
initialize code

what should i do to accomplis the same?

should i make a typeconverter? typeeditor? controldesigner?

what?

//Roger
 
ShouldSerialize and Reset methods should be used in this case, instead of
the DefaultValue() attribute.

i.e.
\\\
Public Property MyBackColor() As Color
..
End Property

Private Function ShouldSerializeMyBackColor() As Boolean
Return Not MyBackColor.Equals(Parent.BackColor)
End Function

Private Sub ResetMyBackColor()
MyBackColor = Parent.BackColor
End Sub
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


Roger said:
Hi, i want to make an ambient property for my control.

i have the ambient part working just fine , but in order to make this work
correctly in designtime i need to be able to set the "DefaultValue" of the
property dynamicly (not via [defaultvalue] attrib)


i mean , when placing a control on a form , the control get the same color
as the parent control , and the color is "defaulted"/"unchanged" it shows
up
in the propbrowser as unchanged (not bold) and it does not persist to the
initialize code

what should i do to accomplis the same?

should i make a typeconverter? typeeditor? controldesigner?

what?

//Roger
 
Back
Top