关于#c##的问题:该错误是使用自己设计的一个控件引起的,里面包含List属性,一但修改这个自定义控件的类库其他代码,设计器就报此错误

C# 设计器报错 类型“AAA”的对象无法转换为类型“AAA

img


”。

该错误是使用自己设计的一个控件引起的,里面包含List属性,一但修改这个自定义控件的类库其他代码,设计器就报此错误。重启VS就又正常了。

private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Page1_Capture));
            this.zrf_HWindow1 = new ZRFCode.MachineVisionAlgorithm.Controls.ZrfWindowControl.Zrf_HWindow();
            this.zrf_HWindow2 = new ZRFCode.MachineVisionAlgorithm.Controls.ZrfWindowControl.Zrf_HWindow();
            this.panel1 = new System.Windows.Forms.Panel();
            this.panel2 = new System.Windows.Forms.Panel();
            this.uiButton1 = new Sunny.UI.UIButton();
            this.uiButton2 = new Sunny.UI.UIButton();
            this.panel1.SuspendLayout();
            this.panel2.SuspendLayout();
            this.SuspendLayout();
            // 
            // zrf_HWindow1
            // 
            this.zrf_HWindow1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.zrf_HWindow1.EnEdit = true;
            this.zrf_HWindow1.EnImgMoveZoom = true;
            this.zrf_HWindow1.EnMenuStrip = true;
            this.zrf_HWindow1.EnShowHRegions = true;
            this.zrf_HWindow1.EnShowHTexts = true;
            this.zrf_HWindow1.EnShowHXLDs = true;
            this.zrf_HWindow1.EnShowRois = true;
            this.zrf_HWindow1.EnShowXldPaths = true;
            this.zrf_HWindow1.HRegions = ((System.Collections.Generic.List)(resources.GetObject("zrf_HWindow1.HRegions")));
            this.zrf_HWindow1.HTexts = ((System.Collections.Generic.List)(resources.GetObject("zrf_HWindow1.HTexts")));
            this.zrf_HWindow1.HXLDs = ((System.Collections.Generic.List)(resources.GetObject("zrf_HWindow1.HXLDs")));
            this.zrf_HWindow1.Image = null;
            this.zrf_HWindow1.Location = new System.Drawing.Point(0, 0);
            this.zrf_HWindow1.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
            this.zrf_HWindow1.Name = "zrf_HWindow1";
            this.zrf_HWindow1.Rois = ((System.Collections.Generic.List)(resources.GetObject("zrf_HWindow1.Rois")));
            this.zrf_HWindow1.Size = new System.Drawing.Size(704, 523);
            this.zrf_HWindow1.TabIndex = 0;
            this.zrf_HWindow1.XldPaths = ((System.Collections.Generic.List)(resources.GetObject("zrf_HWindow1.XldPaths")));
            // 
            // zrf_HWindow2
            // 
            this.zrf_HWindow2.Dock = System.Windows.Forms.DockStyle.Fill;
            this.zrf_HWindow2.EnEdit = true;
            this.zrf_HWindow2.EnImgMoveZoom = true;
            this.zrf_HWindow2.EnMenuStrip = true;
            this.zrf_HWindow2.EnShowHRegions = true;
            this.zrf_HWindow2.EnShowHTexts = true;
            this.zrf_HWindow2.EnShowHXLDs = true;
            this.zrf_HWindow2.EnShowRois = true;
            this.zrf_HWindow2.EnShowXldPaths = true;
            this.zrf_HWindow2.HRegions = ((System.Collections.Generic.List)(resources.GetObject("zrf_HWindow2.HRegions")));
            this.zrf_HWindow2.HTexts = ((System.Collections.Generic.List)(resources.GetObject("zrf_HWindow2.HTexts")));
            this.zrf_HWindow2.HXLDs = ((System.Collections.Generic.List)(resources.GetObject("zrf_HWindow2.HXLDs")));
            this.zrf_HWindow2.Image = null;
            this.zrf_HWindow2.Location = new System.Drawing.Point(0, 0);
            this.zrf_HWindow2.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
            this.zrf_HWindow2.Name = "zrf_HWindow2";
            this.zrf_HWindow2.Rois = ((System.Collections.Generic.List)(resources.GetObject("zrf_HWindow2.Rois")));
            this.zrf_HWindow2.Size = new System.Drawing.Size(697, 523);
            this.zrf_HWindow2.TabIndex = 1;
            this.zrf_HWindow2.XldPaths = ((System.Collections.Generic.List)(resources.GetObject("zrf_HWindow2.XldPaths")));
            // 
            // Page1_Capture
            // 
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
            this.ClientSize = new System.Drawing.Size(1480, 767);
            this.Controls.Add(this.uiButton2);
            this.Controls.Add(this.uiButton1);
            this.Controls.Add(this.panel2);
            this.Controls.Add(this.panel1);
            this.Name = "Page1_Capture";
            this.Text = "Page1_Capture";
            this.panel1.ResumeLayout(false);
            this.panel2.ResumeLayout(false);
            this.ResumeLayout(false);

        }