gpt4 book ai didi

c# - 如何在 C# 中将默认值设置为 propertyygrid 的大小类型属性?

转载 作者:行者123 更新时间:2023-11-30 15:02:27 25 4
gpt4 key购买 nike

我有一个 propertygrid,myclass 是它的对象源。在我的类里面,我从尺寸类型中定义了一项。如何在项目属性中设置默认值?

请看我的代码:

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

我的错误:“System.Drawing.Size”是一个“类型”,但像“变量”一样使用

最佳答案

像这样尝试:

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

关于c# - 如何在 C# 中将默认值设置为 propertyygrid 的大小类型属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12630429/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com