毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> net技术 >> 正文

WindowsControlLibrary1.UserControl1+TabTagUserDraw”的对象无法转换为类型

更新时间:2013-10-29:  来源:毕业论文

使用对象类作为属性,该对象类包含Font、Color、StringAlignment等类型的子属性。在使用时出现下面的错误提示,请问应如何处理?
类型“WindowsControlLibrary1.UserControl1+TabTagUserDraw”的对象无法转换为类型“WindowsControlLibrary1.UserControl1+TabTagUserDraw”

Imports System.ComponentModel
Imports System.Runtime.InteropServices

Public Class UserControl1
    Inherits System.Windows.Forms.TabControl

    Private TabTag As New TabTagUserDraw

    <Browsable(True), Category("外观"), Description("设置标签前景色、背景色及字体")> _
        Public Property TabTagAppearance() As TabTagUserDraw
        Get
            Return TabTag
        End Get
        Set(ByVal value As TabTagUserDraw)
            TabTag.Aligment = value.Aligment
            TabTag.Font = value.Font
            TabTag.BackColor = value.BackColor
            TabTag.ForeColor = value.ForeColor
        End Set
        'NotifyPropertyChanged
错误提示:类型“WindowsControlLibrary1.UserControl1+TabTagUserDraw”的对象无法转换为类型“WindowsControlLibrary1.UserControl1+TabTagUserDraw”
这种情况是在修改了子属性以后发生的,比如在IDE环境下修改Font为“隶体”,查找了一天也没有找出原因...

只有减少了点属性设置就解决了

本案例把以下语句:
 <Serializable(), StructLayout(LayoutKind.Sequential), TypeConverter(GetType(ExpandableObjectConverter))> _
    Class TabTagUserDraw
改变为下面的语句,问题就解决了:
 <TypeConverter(GetType(ExpandableObjectConverter))> _
    Class TabTagUserDraw

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。