|
-
Feb 4th, 2005, 03:26 AM
#1
Thread Starter
Fanatic Member
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.
Last edited by nebulom; Feb 10th, 2005 at 04:57 AM.
-
Feb 4th, 2005, 08:56 AM
#2
Sleep mode
Try it this way :
Code:
private Color color1;
[DefaultValue(typeof(Color),"LightBlue")]
public Color GradientColor1
{
get{ return color1;}
set{ color1=value;}
}
-
Feb 4th, 2005, 08:50 PM
#3
Thread Starter
Fanatic Member
Re: DefaultValue
A million of Thanks.
nebzie
-
Feb 8th, 2005, 03:06 AM
#4
Thread Starter
Fanatic Member
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.
-
Feb 8th, 2005, 09:55 AM
#5
Sleep mode
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;}
}
-
Feb 10th, 2005, 04:57 AM
#6
Thread Starter
Fanatic Member
Re: DefaultValue
Oh. Miss that one. Thanks Pirate.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|