Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 不出现在文档大纲中的控件_C#_Windows Forms Designer - Fatal编程技术网

C# 不出现在文档大纲中的控件

C# 不出现在文档大纲中的控件,c#,windows-forms-designer,C#,Windows Forms Designer,我们有一个问题,其中一些控件在Designer.cs中声明,但在表单或文档大纲上都看不到,例如,假设有一个名为label1的标签,它在Designer上声明如下: private System.Windows.Forms.Label label1; this.label1 = new System.Windows.Forms.Label(); // // label1 // resources.ApplyResources(this.label1, "label1"); this.labe

我们有一个问题,其中一些控件在Designer.cs中声明,但在表单或文档大纲上都看不到,例如,假设有一个名为label1的标签,它在Designer上声明如下:

private System.Windows.Forms.Label label1;
this.label1 = new System.Windows.Forms.Label();

// 
// label1
// 
resources.ApplyResources(this.label1, "label1");
this.label1.BackColor = System.Drawing.Color.Transparent;
this.helpProvider1.SetHelpKeyword(this.label1, resources.GetString("label1.HelpKeyword"));
this.helpProvider1.SetHelpNavigator(this.label1((System.Windows.Forms.HelpNavigator(resources.GetObject("label1.HelpNavigator"))));
this.helpProvider1.SetHelpString(this.label1, resources.GetString("label1.HelpString"));
this.label1.Name = "label1";
this.helpProvider1.SetShowHelp(this.label1, ((bool)(resources.GetObject("label1.ShowHelp"))));
就这样,当我们打开表单时,我们看不到这个标签,也看不到文档大纲上的标签

我们不确定这到底是什么原因造成的,但我们相信这些控件对象不是一次性的,所以当我们在运行时打开from超过100次时,我们将面临内存泄漏和溢出

那么我们的问题是,在所有的解决方案中,有没有办法检测到这些控制?或者我们应该从设计器中手动删除它们?到底是什么导致了这一切,我们如何才能防止它再次发生


谢谢。

尝试在designer.cs中分配this.label1.Text=一个长文本,并检查它是否显示。我没有看到将label1添加到窗体或其他控件的代码……这就是问题所在,控件没有添加到任何位置,我们不记得它是如何创建的,如果它被删除,为什么减速代码仍在设计器中。我试了你的建议,但什么也没发生。