Default value attribute for color property

TechnoTone

Junior Contributor
Joined
Jan 20, 2003
Messages
224
Location
UK - London
I have a custom control with a public color property that I'd like to set the defaultvalue attribute for but as color is an object it cannot be used as a defaultvalue. Is there a way to specify a color as a constant? Is there another way to set the defaultvalue attribute of a color public property?

Here is my code (I've highlighted the problem):

Visual Basic:
'
   <Description("The color used to display the sort icon in the control."), _
    Category("Appearance"), _
    Localizable(True), _
    DefaultValue([u][color=red]Color.Blue[/color][/u])> _
   Property IconColor() As Color
 
Thanks. It has accepted that but it doesn't seem to work. The properties for the control show IconColor in bold indicating a non-default value even when it is Blue. I have just noticed that it is also doing this with the other properties that I have added so the devaultvalue attribute is not having any effect. The other property types are ContentAlignment and a public custom enumeration.
 
You're right. Changing it to this:

Visual Basic:
DefaultValue(GetType(System.Drawing.Color), "0, 0, 255")

Worked for me.
 
Back
Top