Einar,
I thought that I had answered this stuff here before, but it may have been in another forum cuz I can't find it here.
For #1, you said
I have gotten around this by setting the value of the private member (liquidColor) in this example to equal the default color in the constructor of the class. And that's what you need to do. The DefaultValue attribute is only used for resetting in the Property Sheet, not for the initial value when instantiating the class.
For #2, you said
What exactly does RefreshProperties(RefreshProperties.Repaint) do for me? I've never used this attribute, but I looked it up in the docs, and this is what it says:
Specify this attribute on a property to repaint all properties in the PropertyGrid when the property value changes.~~Bonnie
>I have the following property in my usercontrol:
>
>[Category("Appearance")]
>[Description("The color of the liquid that is inside the thermometer.")]
>[DefaultValue(typeof(Color),"Red")]
>[RefreshProperties(RefreshProperties.Repaint)]
>public Color LiqidColor
>{
> get
> {
> return this.liquidColor;
> }
> set
> {
> this.liquidColor = value;
> }
>}
>
>
>Now I have two issues with this.
>1. If I right-click in the property sheet and select reset the color returns to Red which is great but when I rebuild the color is all of a sudden gone. What is up with that? I have gotten around this by setting the value of the private member (liquidColor) in this example to equal the default color in the constructor of the class.
>
>2. What is supposed to happend when I change the color in the designer's property sheet? Shouldn't the color change? (I use this color in the OnPaint event. What exactly does
RefreshProperties(RefreshProperties.Repaint) do for me?
>
>Thanks,
>Einar