2010-08-04 132 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