簡體   English   中英

如何在c#中將defaulty的默認值設置為propertyygrid的大小類型屬性?

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

我有一個屬性網格,myclass是它的對象源。 在我的班級中,我從大小類型中定義了一個項目。 如何在item屬性中設置默認值?

請看我的代碼:

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

我的錯誤:'System.Drawing.Size'是'type'但是像'變量'一樣使用

試試這樣:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM