Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set default value to size type property of propertyygrid in c#?

I have a propertygrid that myclass is objectsource of it. In my class I define one item from Size type. How can I set default value in item attribute ?

Please see my code :

[CategoryAttribute("Information"), DefaultValue(Size(0, 0))]
public Size AndaazehPixel { get; set; }

my error : 'System.Drawing.Size' is a 'type' but is used like a 'variable'

like image 572
Ali Ahmadi Avatar asked Oct 20 '25 05:10

Ali Ahmadi


1 Answers

Try it like this:

[DefaultValue(typeof(Size), "0, 0")]
public Size AndaazehPixel { get; set; }
like image 99
LarsTech Avatar answered Oct 22 '25 19:10

LarsTech