-
DefaultValue
What's wrong with
Code:
Color color1;
[DefaultValue(Color.LightBlue)]
public Color GradientColor1
{
get{ return color1;}
set{ color1=value;}
}
?
This gives me F:\My Project\c#\nebzie\swing\NPanel.cs(27): An attribute argument must be a constant expression, typeof expression or array creation expression.
-
Try it this way :
Code:
private Color color1;
[DefaultValue(typeof(Color),"LightBlue")]
public Color GradientColor1
{
get{ return color1;}
set{ color1=value;}
}
-
Re: DefaultValue
A million of Thanks.
nebzie
-
Re: DefaultValue
Pirate,
Hello. It still doesn't got to the property Window. I mean, i'm writing a custom panel and when I add it on the toolbox and drag it, GradientColor1 property still has no default value. Am I missing something?
Thank you.
-
You wouldn't need it then , just do like and initialize the variable with the color you want the control to be set to :
Code:
private Color color1=Color.LightBlue;
public Color GradientColor1
{
get{ return color1;}
set{ color1=value;}
}
-
Re: DefaultValue
Oh. Miss that one. Thanks Pirate.