Ali Ahmadi
Ali Ahmadi

Reputation: 2417

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'

Upvotes: 4

Views: 2311

Answers (1)

LarsTech
LarsTech

Reputation: 81675

Try it like this:

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

Upvotes: 9

Related Questions