【发布时间】:2021-06-09 01:00:52
【问题描述】:
我在使用 .NET C# Windows 窗体应用程序时遇到问题,我无法让窗体在调试模式或发布模式下显示。以前是这样,所以一定有什么改变了。我不知道是什么,但是当我想测试它并看到表单看起来像以前那样时却没有。这是一个表单,上面有 3 个选项卡式控件,每个控件执行不同的操作。
当我重建调试版本并点击播放时,没有任何反应,没有显示任何形式。当我构建它时,构建窗口中也没有显示错误。 所以我开始调试,什么也没发生,所以我等待,它需要很长时间,然后我点击暂停按钮,它在随机行上暂停,例如
this.lblTesting.Size = new System.Drawing.Size(45, 13);
出现此错误。
$exception error CS0103: The name '$exception' does not exist in the current context.
如果我点击继续,那么仍然没有显示表单,当我点击暂停时,它就停在这条线上。
this.tabControl.ResumeLayout(false);
出现错误 {"Exception of type 'System.StackOverflowException' was throwed."}
所以我不知道如何重建 Form1.Designer.cs 页面以使其全部正确。
这些是我在最终错误之后遇到的错误。
Hunter.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Hunter.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\Reid\Documents\Visual Studio 2017\Projects\Hunter\Hunter\bin\Debug\Hunter.exe'. Symbols loaded.
'Hunter.exe' (CLR v4.0.30319: Hunter.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Hunter.exe' (CLR v4.0.30319: Hunter.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Hunter.exe' (CLR v4.0.30319: Hunter.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Hunter.exe' (CLR v4.0.30319: Hunter.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Hunter.exe' (CLR v4.0.30319: Hunter.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Hunter.exe' (CLR v4.0.30319: Hunter.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Process is terminated due to StackOverflowException.
An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll
The program '[22072] Hunter.exe' has exited with code -2147023895 (0x800703e9).
所以我从这里和其他地方阅读了一些文章,说要转到表单,添加新内容或更改某些内容,然后保存表单并重建它,然后应该重建有问题的表单的设计器类这似乎没有解决我的问题。
我尝试在 Form1.cs [Design] 上的另一个标签旁边添加一个新标签,并更改 Form1.cs 中的代码以在其中输出某些内容,而不是像原来那样更改原始标签的整个值.
这让我构建它时不会发生错误。
然而,在 Debug Play 上,它做了和以前一样的事情。
然后我不小心添加了一个新表单。我不想要这个表单,所以我尝试在解决方案中右键单击期望“删除”或“删除表单”选项,但没有出现。我进入文件浏览器并删除了以 Form2 开头的所有内容。然后我读到我应该在记事本中打开 Hunter.csproj 并删除对我所做的那个表单的引用。
现在,当我尝试转到 Form1.cs [Design] 时,我收到错误页面:
The designer could not be shown for this file because none of the classes within it can be designed.
Instances of this error (1)
1. Hide Call Stack
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)
我尝试使用“清洁解决方案”选项、“对解决方案运行代码分析”和“重建”,但我无法显示该表单。所以我没有史酷比该怎么办。
这不好,因为没有显示“忽略并继续”按钮或任何黄色条来显示错误。但是,如果我在顶部搜索错误,则会有一个部分显示
无法显示此文件的设计器,因为其中没有任何类可以设计。
当 Visual Studio 找不到满足设计器要求的基类时会发生此错误。窗体和控件必须派生自支持设计器的基类。如果您从继承的表单或控件派生,请确保项目已构建。
我只是不知道为什么没有“修复”按钮,它会将您在实际表单设计页面上设置的所有属性重新应用到表单设计器类。或者,如果您刚刚保存了表单页面,它会重新构建类。必须从您创建表单的属性和工具箱对象中正确重建表单后面的类?这对 Microsoft 来说是一个非常好的想法,将其添加到 IDE 中:),它会分析代码、任何错误和错误消息,并尽力自动修复项目。
所以我不知道该怎么办。如何重建我不记得首先接触的整个 Form1.Designer.cs 类。如何取回我的表单,如何重建它以使表单设计器类正确并运行调试以实际查看表单。
这是 Form1.Designer.cs 类的整个类 - 根据评论的要求显示
namespace Hunter
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tabControl = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.lblLocalHostNameValue = new System.Windows.Forms.Label();
this.listBoxPing = new System.Windows.Forms.ListBox();
this.lstLocalIP = new System.Windows.Forms.ListView();
this.lblLocalHostName = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.lblUserIPDetails = new System.Windows.Forms.Label();
this.lblOnlineStatus = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.lblStatus = new System.Windows.Forms.Label();
this.lblCountry = new System.Windows.Forms.Label();
this.cmdCancel = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.cmdClear = new System.Windows.Forms.Button();
this.lblPing = new System.Windows.Forms.Label();
this.ProgressBar = new System.Windows.Forms.ProgressBar();
this.lblHostName = new System.Windows.Forms.Label();
this.lblTesting = new System.Windows.Forms.Label();
this.lblValidIP = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txtIPAddress = new System.Windows.Forms.TextBox();
this.cmdStartScan = new System.Windows.Forms.Button();
this.PortScanResults = new System.Windows.Forms.ListView();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.lblProxyListStatus = new System.Windows.Forms.Label();
this.ProxyProgressBar = new System.Windows.Forms.ProgressBar();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.label10 = new System.Windows.Forms.Label();
this.lstProxies = new System.Windows.Forms.ListView();
this.tabControl.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.SuspendLayout();
//
// tabControl
//
this.tabControl.Controls.Add(this.tabPage1);
this.tabControl.Controls.Add(this.tabPage2);
this.tabControl.Controls.Add(this.tabPage3);
this.tabControl.Dock = System.Windows.Forms.DockStyle.Top;
this.tabControl.HotTrack = true;
this.tabControl.ItemSize = new System.Drawing.Size(500, 18);
this.tabControl.Location = new System.Drawing.Point(0, 0);
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
this.tabControl.Size = new System.Drawing.Size(791, 401);
this.tabControl.TabIndex = 1;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.lblLocalHostNameValue);
this.tabPage1.Controls.Add(this.listBoxPing);
this.tabPage1.Controls.Add(this.lstLocalIP);
this.tabPage1.Controls.Add(this.lblLocalHostName);
this.tabPage1.Controls.Add(this.label3);
this.tabPage1.Controls.Add(this.lblUserIPDetails);
this.tabPage1.Controls.Add(this.lblOnlineStatus);
this.tabPage1.Controls.Add(this.label6);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(783, 375);
this.tabPage1.TabIndex = 3;
this.tabPage1.Text = "Home";
this.tabPage1.UseVisualStyleBackColor = true;
this.tabPage1.Click += new System.EventHandler(this.tabPage1_Click);
//
// lblLocalHostNameValue
//
this.lblLocalHostNameValue.AutoSize = true;
this.lblLocalHostNameValue.Location = new System.Drawing.Point(105, 37);
this.lblLocalHostNameValue.Name = "lblLocalHostNameValue";
this.lblLocalHostNameValue.Size = new System.Drawing.Size(22, 13);
this.lblLocalHostNameValue.TabIndex = 31;
this.lblLocalHostNameValue.Text = "NA";
//
// listBoxPing
//
this.listBoxPing.FormattingEnabled = true;
this.listBoxPing.Location = new System.Drawing.Point(403, 17);
this.listBoxPing.Name = "listBoxPing";
this.listBoxPing.Size = new System.Drawing.Size(354, 82);
this.listBoxPing.TabIndex = 30;
this.listBoxPing.SelectedIndexChanged += new System.EventHandler(this.listBoxPing_SelectedIndexChanged);
//
// lstLocalIP
//
this.lstLocalIP.HideSelection = false;
this.lstLocalIP.Location = new System.Drawing.Point(15, 125);
this.lstLocalIP.Name = "lstLocalIP";
this.lstLocalIP.Size = new System.Drawing.Size(760, 182);
this.lstLocalIP.TabIndex = 12;
this.lstLocalIP.UseCompatibleStateImageBehavior = false;
this.lstLocalIP.View = System.Windows.Forms.View.Details;
//
// lblLocalHostName
//
this.lblLocalHostName.AutoSize = true;
this.lblLocalHostName.Location = new System.Drawing.Point(29, 37);
this.lblLocalHostName.Name = "lblLocalHostName";
this.lblLocalHostName.Size = new System.Drawing.Size(60, 13);
this.lblLocalHostName.TabIndex = 29;
this.lblLocalHostName.Text = "Host Name";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(29, 15);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(349, 13);
this.label3.TabIndex = 27;
this.label3.Text = "Details about the local computer the program is running from";
//
// lblUserIPDetails
//
this.lblUserIPDetails.AutoSize = true;
this.lblUserIPDetails.Location = new System.Drawing.Point(29, 90);
this.lblUserIPDetails.Name = "lblUserIPDetails";
this.lblUserIPDetails.Size = new System.Drawing.Size(111, 13);
this.lblUserIPDetails.TabIndex = 26;
this.lblUserIPDetails.Text = "Local Machine IP Info";
//
// lblOnlineStatus
//
this.lblOnlineStatus.AutoSize = true;
this.lblOnlineStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblOnlineStatus.ForeColor = System.Drawing.Color.DarkBlue;
this.lblOnlineStatus.Location = new System.Drawing.Point(102, 65);
this.lblOnlineStatus.Name = "lblOnlineStatus";
this.lblOnlineStatus.Size = new System.Drawing.Size(44, 13);
this.lblOnlineStatus.TabIndex = 25;
this.lblOnlineStatus.Text = "Offline";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label6.Location = new System.Drawing.Point(29, 65);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(76, 13);
this.label6.TabIndex = 24;
this.label6.Text = "Online Status: ";
//
// tabPage2
//
this.tabPage2.Controls.Add(this.lblStatus);
this.tabPage2.Controls.Add(this.lblCountry);
this.tabPage2.Controls.Add(this.cmdCancel);
this.tabPage2.Controls.Add(this.label1);
this.tabPage2.Controls.Add(this.cmdClear);
this.tabPage2.Controls.Add(this.lblPing);
this.tabPage2.Controls.Add(this.ProgressBar);
this.tabPage2.Controls.Add(this.lblHostName);
this.tabPage2.Controls.Add(this.lblTesting);
this.tabPage2.Controls.Add(this.lblValidIP);
this.tabPage2.Controls.Add(this.label2);
this.tabPage2.Controls.Add(this.txtIPAddress);
this.tabPage2.Controls.Add(this.cmdStartScan);
this.tabPage2.Controls.Add(this.PortScanResults);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(783, 375);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Port Scan";
this.tabPage2.UseVisualStyleBackColor = true;
//
// lblStatus
//
this.lblStatus.AutoSize = true;
this.lblStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblStatus.Location = new System.Drawing.Point(510, 17);
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(61, 13);
this.lblStatus.TabIndex = 26;
this.lblStatus.Text = "WAITING";
//
// lblCountry
//
this.lblCountry.AutoSize = true;
this.lblCountry.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblCountry.Location = new System.Drawing.Point(507, 94);
this.lblCountry.Name = "lblCountry";
this.lblCountry.Size = new System.Drawing.Size(95, 17);
this.lblCountry.TabIndex = 25;
this.lblCountry.Text = "Country: NA";
this.lblCountry.Visible = false;
//
// cmdCancel
//
this.cmdCancel.Enabled = false;
this.cmdCancel.Location = new System.Drawing.Point(530, 319);
this.cmdCancel.Name = "cmdCancel";
this.cmdCancel.Size = new System.Drawing.Size(112, 23);
this.cmdCancel.TabIndex = 24;
this.cmdCancel.Text = "Cancel";
this.cmdCancel.UseVisualStyleBackColor = true;
this.cmdCancel.Click += new System.EventHandler(this.cmdCancel_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(180, -40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(69, 20);
this.label1.TabIndex = 23;
this.label1.Text = "Waiting";
//
// cmdClear
//
this.cmdClear.Location = new System.Drawing.Point(412, 319);
this.cmdClear.Name = "cmdClear";
this.cmdClear.Size = new System.Drawing.Size(112, 23);
this.cmdClear.TabIndex = 22;
this.cmdClear.Text = "Clear";
this.cmdClear.UseVisualStyleBackColor = true;
this.cmdClear.Click += new
System.EventHandler(this.cmdClear_Click);
// lblHostName
//
this.lblHostName.AutoSize = true;
this.lblHostName.Location = new System.Drawing.Point(507, 39);
this.lblHostName.Name = "lblHostName";
this.lblHostName.Size = new System.Drawing.Size(66, 13);
this.lblHostName.TabIndex = 19;
this.lblHostName.Text = "Host Name: ";
this.lblHostName.Visible = false;
//
// lblTesting
//
this.lblTesting.AutoSize = true;
this.lblTesting.Location = new System.Drawing.Point(36, 168);
this.lblTesting.Name = "lblTesting";
this.lblTesting.Size = new System.Drawing.Size(45, 13);
this.lblTesting.TabIndex = 18;
this.lblTesting.Text = "Testing:";
this.lblTesting.Visible = false;
//
// lblValidIP
//
this.lblValidIP.AutoSize = true;
this.lblValidIP.ForeColor = System.Drawing.Color.Blue;
this.lblValidIP.Location = new System.Drawing.Point(122, 243);
this.lblValidIP.Name = "lblValidIP";
this.lblValidIP.Size = new System.Drawing.Size(30, 13);
this.lblValidIP.TabIndex = 17;
this.lblValidIP.Text = "Valid";
this.lblValidIP.Visible = false;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(36, 243);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(58, 13);
this.label2.TabIndex = 16;
this.label2.Text = "IP Address";
//
// txtIPAddress
//
this.txtIPAddress.Location = new System.Drawing.Point(36, 256);
this.txtIPAddress.Name = "txtIPAddress";
this.txtIPAddress.Size = new System.Drawing.Size(192, 20);
this.txtIPAddress.TabIndex = 15;
this.txtIPAddress.TextChanged += new System.EventHandler(this.txtIPAddress_TextChanged);
//
// cmdStartScan
//
this.cmdStartScan.Location = new System.Drawing.Point(648, 319);
this.cmdStartScan.Name = "cmdStartScan";
this.cmdStartScan.Size = new System.Drawing.Size(112, 23);
this.cmdStartScan.TabIndex = 14;
this.cmdStartScan.Text = "Start Scan";
this.cmdStartScan.UseVisualStyleBackColor = true;
this.cmdStartScan.Click += new System.EventHandler(this.cmdStartScan_Click);
//
// PortScanResults
//
this.PortScanResults.HideSelection = false;
this.PortScanResults.Location = new System.Drawing.Point(36, 14);
this.PortScanResults.Name = "PortScanResults";
this.PortScanResults.Size = new System.Drawing.Size(430, 138);
this.PortScanResults.TabIndex = 13;
this.PortScanResults.UseCompatibleStateImageBehavior = false;
this.PortScanResults.View = System.Windows.Forms.View.Details;
//
// tabPage3
//
this.tabPage3.Controls.Add(this.lblProxyListStatus);
this.tabPage3.Controls.Add(this.ProxyProgressBar);
this.tabPage3.Controls.Add(this.button2);
this.tabPage3.Controls.Add(this.button3);
this.tabPage3.Controls.Add(this.label10);
this.tabPage3.Controls.Add(this.lstProxies);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(783, 375);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Proxies";
this.tabPage3.UseVisualStyleBackColor = true;
//
// lblProxyListStatus
//
this.lblProxyListStatus.AutoSize = true;
this.lblProxyListStatus.Location = new System.Drawing.Point(18, 287);
this.lblProxyListStatus.Name = "lblProxyListStatus";
this.lblProxyListStatus.Size = new System.Drawing.Size(81, 13);
this.lblProxyListStatus.TabIndex = 19;
this.lblProxyListStatus.Text = "Checking Proxy";
//
// ProxyProgressBar
//
this.ProxyProgressBar.Location = new System.Drawing.Point(15, 241);
this.ProxyProgressBar.Name = "ProxyProgressBar";
this.ProxyProgressBar.Size = new System.Drawing.Size(760, 23);
this.ProxyProgressBar.TabIndex = 18;
//
// button2
//
this.button2.Location = new System.Drawing.Point(512, 314);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(112, 23);
this.button2.TabIndex = 17;
this.button2.Text = "Find Proxies";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(647, 314);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(112, 23);
this.button3.TabIndex = 16;
this.button3.Text = "Check Proxies";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label10
//
this.label10.AutoSize = true;
this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label10.Location = new System.Drawing.Point(15, 17);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(48, 13);
this.label10.TabIndex = 13;
this.label10.Text = "Proxies";
//
// lstProxies
//
this.lstProxies.HideSelection = false;
this.lstProxies.Location = new System.Drawing.Point(15, 41);
this.lstProxies.Name = "lstProxies";
this.lstProxies.Size = new System.Drawing.Size(760, 182);
this.lstProxies.TabIndex = 12;
this.lstProxies.UseCompatibleStateImageBehavior = false;
this.lstProxies.View = System.Windows.Forms.View.Details;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(791, 413);
this.Controls.Add(this.tabControl);
this.Name = "Form1";
this.Text = "Proxy Hunter";
this.Load += new System.EventHandler(this.Form1_Load);
this.tabControl.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabControl;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.ProgressBar ProxyProgressBar;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.ListView lstProxies;
private System.Windows.Forms.Label lblCountry;
private System.Windows.Forms.Button cmdCancel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button cmdClear;
private System.Windows.Forms.Label lblPing;
private System.Windows.Forms.ProgressBar ProgressBar;
private System.Windows.Forms.Label lblHostName;
private System.Windows.Forms.Label lblTesting;
private System.Windows.Forms.Label lblValidIP;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtIPAddress;
private System.Windows.Forms.Button cmdStartScan;
private System.Windows.Forms.ListView PortScanResults;
private System.Windows.Forms.Label lblStatus;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label lblUserIPDetails;
private System.Windows.Forms.Label lblOnlineStatus;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label lblLocalHostName;
private System.Windows.Forms.Label lblProxyListStatus;
private System.Windows.Forms.ListView lstLocalIP;
private System.Windows.Forms.ListBox listBoxPing;
private System.Windows.Forms.Label lblLocalHostNameValue;
}
}
【问题讨论】:
-
不知何故通过 VS 2017 的循环重启发生了大约 3 次错误页面已经消失而不是我的表单设计页面但是当我点击播放按钮调试运行时,它仍然停止在这个.tabControl.ResumeLayout(false);如果我等待足够长的时间让它停止并出错而没有暂停 - 它只会在任何一行停止并显示异常不是定义错误。那么如何重建 Form1.Designer.cs 类,以便使用我的拖放工具、标签、标签等正确重建它。因为我不知道为什么它在哪里出错而不显示表单。跨度>
-
我找到了一个旧版本的 VS 2010 项目,在同一个文件中它只有两个选项卡,一个有任何选项。旧文件中的代码没有 this.Load += new System.EventHandler(this.Form1_Load);在方法中,但有 this.tabControl.ResumeLayout(false); this.tabPage3.ResumeLayout(false); this.tabPage3.PerformLayout(); this.ResumeLayout(false);它可以工作并显示表格。我试过将它复制进去,但这没有什么区别,如果我留下一个空的部分类,那么设计模式表单是空的,所以重建什么都没有。我不知道如何重建这个设计器类以便它工作
-
您的表单启动代码中似乎存在一些递归错误。当它崩溃时,你能显示堆栈的顶部条目吗?
-
发布您的 Form1.Designer.cs 和 Form1.cs 代码也可能会有所帮助。
-
这适用于 .NET Framework 4.7.1 和 .NET 5 上的 VS Enterprise 2019 版本 16.9.1。我唯一更改的是删除事件处理程序,以便可以编译。你也可以发布.cs文件吗?您是否有可能在默认构造函数中有代码破坏了您的设计器?你能把你的表格移到一个干净的项目上并重现它吗?尝试从默认构造函数中删除所有代码
标签: c# .net visual-studio winforms compiler-errors