TechnoTone Posted January 20, 2003 Posted January 20, 2003 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): ' <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 Quote TT (*_*) There are 10 types of people in this world; those that understand binary and those that don't.
*Gurus* divil Posted January 20, 2003 *Gurus* Posted January 20, 2003 <DefaultValue(GetType(Color), "Color.Blue")> Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
TechnoTone Posted January 20, 2003 Author Posted January 20, 2003 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. Quote TT (*_*) There are 10 types of people in this world; those that understand binary and those that don't.
*Gurus* divil Posted January 20, 2003 *Gurus* Posted January 20, 2003 You're right. Changing it to this: DefaultValue(GetType(System.Drawing.Color), "0, 0, 255") Worked for me. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
TechnoTone Posted January 20, 2003 Author Posted January 20, 2003 Thanks very much. I done a similar thing with the other properties too and they're working now also. :D Quote TT (*_*) There are 10 types of people in this world; those that understand binary and those that don't.
NicoVB Posted January 20, 2003 Posted January 20, 2003 Interesting to post this. Have been struggling also with this problem. So thanks for the useful information!! Quote Visit http://www.nico.gotdns.com Now ONLINE!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.