2010-08-04 236 views
0

我寫了一個自定義屬性,並得到了我想要的用戶能夠以指示屬性一類的顏色屬性下面的顏色屬性:顏色屬性在自定義屬性

Private _ColumnColor As System.Drawing.Color 
    Public Property ColumnColor() As System.Drawing.Color 
     Get 
      Return _ColumnColor 
     End Get 
     Set(ByVal value As System.Drawing.Color) 
      _ColumnColor = value 
     End Set 
    End Property 

我越來越出現以下錯誤:

"Property or field 'ColumnColor' does not have a valid attribute type 

我該如何解決?

感謝

+0

請問您的項目參考System.Drawing中「? – 2010-08-05 00:40:46

回答

0

我就開始添加AttributeUsage你的財產

<AttributeUsage(AttributeTargets.Property)> _ 
Private _ColumnColor As System.Drawing.Color 
    Public Property ColumnColor() As System.Drawing.Color 
     Get 
      Return _ColumnColor 
     End Get 
     Set(ByVal value As System.Drawing.Color) 
      _ColumnColor = value 
     End Set 
    End Property 
+0

不,我得到的數據類型是允許的誤差。 – Lennie 2010-08-05 08:06:19