[英]How can I set default value to size type property of propertyygrid in c#?
I have a propertygrid that myclass is objectsource of it. 我有一个属性网格,myclass是它的对象源。 In my class I define one item from Size type.
在我的班级中,我从大小类型中定义了一个项目。 How can I set default value in item attribute ?
如何在item属性中设置默认值?
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' 我的错误:'System.Drawing.Size'是'type'但是像'变量'一样使用
Try it like this: 试试这样:
[DefaultValue(typeof(Size), "0, 0")]
public Size AndaazehPixel { get; set; }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.