C# 无效操作异常库。处置(处置)

C# 无效操作异常库。处置(处置),c#,exception,dispose,C#,Exception,Dispose,我正在为PLC创建诊断应用程序。我有一个表单和几个控件,它们继承了UserControl。这控制着我的开关。一个视图是仪表板、图形等。图形运行时,发生异常。异常显示在Form1.Designer.cs中的“base.Dispose(disposing)”行。你知道我该怎么修吗?谢谢你的建议 这是Form1.Designer.cs的代码。在基线上显示错误。Dispose(disposing)。基本上我不知道这部分代码的作用。我不能修理它。谁能告诉我,它是怎么工作的?这部分什么时候叫?我在程序中找

我正在为PLC创建诊断应用程序。我有一个表单和几个控件,它们继承了UserControl。这控制着我的开关。一个视图是仪表板、图形等。图形运行时,发生异常。异常显示在Form1.Designer.cs中的“base.Dispose(disposing)”行。你知道我该怎么修吗?谢谢你的建议


这是Form1.Designer.cs的代码。在基线上显示错误。Dispose(disposing)。基本上我不知道这部分代码的作用。我不能修理它。谁能告诉我,它是怎么工作的?这部分什么时候叫?我在程序中找不到任何方法Dispose()的用法,只覆盖每个控件中的方法(从UserControl继承)。谢谢

命名空间Windows窗体应用程序1 { 部分类Form1 { /// ///必需的设计器变量。 /// 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)
    {
        /*Updated 8.4.2013*/
        //try
        //{
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        //}
        //catch { }
    }

    #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()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
        this.statusStrip1 = new System.Windows.Forms.StatusStrip();
        this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
        this.btn_ChangeLanguage = new System.Windows.Forms.Button();
        this.pictureBox1 = new System.Windows.Forms.PictureBox();
        this.Zobraz_Palubka = new System.Windows.Forms.Button();
        this.Zobraz_Verzi = new System.Windows.Forms.Button();
        this.Zobraz_error = new System.Windows.Forms.Button();
        this.Zobraz_Nastaveni = new System.Windows.Forms.Button();
        this.Zobraz_TestIO = new System.Windows.Forms.Button();
        this.Zobraz_monitor = new System.Windows.Forms.Button();
        this.statusStrip1.SuspendLayout();
        ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
        this.SuspendLayout();
        // 
        // statusStrip1
        // 
        this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
        this.toolStripStatusLabel1});
        resources.ApplyResources(this.statusStrip1, "statusStrip1");
        this.statusStrip1.Name = "statusStrip1";
        // 
        // toolStripStatusLabel1
        // 
        this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
        resources.ApplyResources(this.toolStripStatusLabel1, "toolStripStatusLabel1");
        // 
        // btn_ChangeLanguage
        // 
        this.btn_ChangeLanguage.Image = global::WindowsFormsApplication1.Properties.Resources.flag_cze_mini;
        resources.ApplyResources(this.btn_ChangeLanguage, "btn_ChangeLanguage");
        this.btn_ChangeLanguage.Name = "btn_ChangeLanguage";
        this.btn_ChangeLanguage.UseVisualStyleBackColor = true;
        this.btn_ChangeLanguage.Click += new System.EventHandler(this.btn_ChangeLanguage_Click);
        this.btn_ChangeLanguage.MouseEnter += new System.EventHandler(this.Zobraz_Nastaveni_MouseEnter);
        this.btn_ChangeLanguage.MouseLeave += new System.EventHandler(this.Zobraz_Nastaveni_MouseLeave);
        // 
        // pictureBox1
        // 
        this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
        this.pictureBox1.Image = global::WindowsFormsApplication1.Properties.Resources.trojuhelnik;
        resources.ApplyResources(this.pictureBox1, "pictureBox1");
        this.pictureBox1.Name = "pictureBox1";
        this.pictureBox1.TabStop = false;
        // 
        // Zobraz_Palubka
        // 
        this.Zobraz_Palubka.Image = global::WindowsFormsApplication1.Properties.Resources.tachometr_mini;
        resources.ApplyResources(this.Zobraz_Palubka, "Zobraz_Palubka");
        this.Zobraz_Palubka.Name = "Zobraz_Palubka";
        this.Zobraz_Palubka.UseVisualStyleBackColor = true;
        this.Zobraz_Palubka.Click += new System.EventHandler(this.Zobraz_Click);
        this.Zobraz_Palubka.MouseEnter += new System.EventHandler(this.Zobraz_Nastaveni_MouseEnter);
        this.Zobraz_Palubka.MouseLeave += new System.EventHandler(this.Zobraz_Nastaveni_MouseLeave);
        // 
        // Zobraz_Verzi
        // 
        this.Zobraz_Verzi.Image = global::WindowsFormsApplication1.Properties.Resources.info_mini;
        resources.ApplyResources(this.Zobraz_Verzi, "Zobraz_Verzi");
        this.Zobraz_Verzi.Name = "Zobraz_Verzi";
        this.Zobraz_Verzi.UseVisualStyleBackColor = true;
        this.Zobraz_Verzi.Click += new System.EventHandler(this.Zobraz_Click);
        this.Zobraz_Verzi.MouseEnter += new System.EventHandler(this.Zobraz_Nastaveni_MouseEnter);
        this.Zobraz_Verzi.MouseLeave += new System.EventHandler(this.Zobraz_Nastaveni_MouseLeave);
        // 
        // Zobraz_error
        // 
        this.Zobraz_error.Image = global::WindowsFormsApplication1.Properties.Resources.error1_mini;
        resources.ApplyResources(this.Zobraz_error, "Zobraz_error");
        this.Zobraz_error.Name = "Zobraz_error";
        this.Zobraz_error.UseVisualStyleBackColor = true;
        this.Zobraz_error.Click += new System.EventHandler(this.Zobraz_Click);
        this.Zobraz_error.MouseEnter += new System.EventHandler(this.Zobraz_Nastaveni_MouseEnter);
        this.Zobraz_error.MouseLeave += new System.EventHandler(this.Zobraz_Nastaveni_MouseLeave);
        // 
        // Zobraz_Nastaveni
        // 
        this.Zobraz_Nastaveni.Image = global::WindowsFormsApplication1.Properties.Resources.settings_mini;
        resources.ApplyResources(this.Zobraz_Nastaveni, "Zobraz_Nastaveni");
        this.Zobraz_Nastaveni.Name = "Zobraz_Nastaveni";
        this.Zobraz_Nastaveni.UseVisualStyleBackColor = true;
        this.Zobraz_Nastaveni.Click += new System.EventHandler(this.Zobraz_Click);
        this.Zobraz_Nastaveni.MouseEnter += new System.EventHandler(this.Zobraz_Nastaveni_MouseEnter);
        this.Zobraz_Nastaveni.MouseLeave += new System.EventHandler(this.Zobraz_Nastaveni_MouseLeave);
        // 
        // Zobraz_TestIO
        // 
        this.Zobraz_TestIO.Image = global::WindowsFormsApplication1.Properties.Resources.testIO_mini;
        resources.ApplyResources(this.Zobraz_TestIO, "Zobraz_TestIO");
        this.Zobraz_TestIO.Name = "Zobraz_TestIO";
        this.Zobraz_TestIO.UseVisualStyleBackColor = true;
        this.Zobraz_TestIO.Click += new System.EventHandler(this.Zobraz_Click);
        this.Zobraz_TestIO.MouseEnter += new System.EventHandler(this.Zobraz_Nastaveni_MouseEnter);
        this.Zobraz_TestIO.MouseLeave += new System.EventHandler(this.Zobraz_Nastaveni_MouseLeave);
        // 
        // Zobraz_monitor
        // 
        this.Zobraz_monitor.Image = global::WindowsFormsApplication1.Properties.Resources.line_graph_icon_mini;
        resources.ApplyResources(this.Zobraz_monitor, "Zobraz_monitor");
        this.Zobraz_monitor.Name = "Zobraz_monitor";
        this.Zobraz_monitor.UseVisualStyleBackColor = true;
        this.Zobraz_monitor.Click += new System.EventHandler(this.Zobraz_Click);
        this.Zobraz_monitor.MouseEnter += new System.EventHandler(this.Zobraz_Nastaveni_MouseEnter);
        this.Zobraz_monitor.MouseLeave += new System.EventHandler(this.Zobraz_Nastaveni_MouseLeave);
        // 
        // Form1
        // 
        resources.ApplyResources(this, "$this");
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.Controls.Add(this.btn_ChangeLanguage);
        this.Controls.Add(this.pictureBox1);
        this.Controls.Add(this.Zobraz_Palubka);
        this.Controls.Add(this.Zobraz_Verzi);
        this.Controls.Add(this.Zobraz_error);
        this.Controls.Add(this.statusStrip1);
        this.Controls.Add(this.Zobraz_Nastaveni);
        this.Controls.Add(this.Zobraz_TestIO);
        this.Controls.Add(this.Zobraz_monitor);
        this.Name = "Form1";
        this.statusStrip1.ResumeLayout(false);
        this.statusStrip1.PerformLayout();
        ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
        this.ResumeLayout(false);
        this.PerformLayout();

    }

    #endregion

    private System.Windows.Forms.Button Zobraz_monitor;
    private System.Windows.Forms.Button Zobraz_Nastaveni;
    private System.Windows.Forms.StatusStrip statusStrip1;
    private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
    private System.Windows.Forms.Button Zobraz_TestIO;
    private System.Windows.Forms.Button Zobraz_error;
    private System.Windows.Forms.Button Zobraz_Verzi;
    private System.Windows.Forms.Button Zobraz_Palubka;
    private System.Windows.Forms.PictureBox pictureBox1;
    private System.Windows.Forms.Button btn_ChangeLanguage;
}
//
///清理所有正在使用的资源。
/// 
///如果应释放托管资源,则为true;否则为false。
受保护的覆盖无效处置(布尔处置)
{
/*更新日期:2013年4月8日*/
//试一试
//{
if(处理和(组件!=null))
{
组件。Dispose();
}
基地。处置(处置);
//}
//捕获{}
}
#区域Windows窗体设计器生成的代码
/// 
///设计器支持所需的方法-不修改
///此方法的内容与代码编辑器一起使用。
/// 
私有void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager资源=新的System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.statusStrip1=new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1=新系统.Windows.Forms.ToolStripStatusLabel();
this.btn_ChangeLanguage=new System.Windows.Forms.Button();
this.pictureBox1=新系统.Windows.Forms.PictureBox();
this.Zobraz_Palubka=new System.Windows.Forms.Button();
this.Zobraz_Verzi=new System.Windows.Forms.Button();
this.Zobraz_error=new System.Windows.Forms.Button();
this.Zobraz_Nastaveni=new System.Windows.Forms.Button();
this.Zobraz_TestIO=new System.Windows.Forms.Button();
this.Zobraz_monitor=new System.Windows.Forms.Button();
this.statusStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
这个.SuspendLayout();
// 
//状态条带1
// 
this.statusStrip1.Items.AddRange(新System.Windows.Forms.ToolStripItem[]{
此参数为.toolStripStatusLabel1});
resources.ApplyResources(this.statusStrip1,“statusStrip1”);
this.statusStrip1.Name=“statusStrip1”;
// 
//toolStripStatusLabel1
// 
this.toolStripStatusLabel1.Name=“toolStripStatusLabel1”;
resources.ApplyResources(this.toolStripStatusLabel1,“toolStripStatusLabel1”);
// 
//英语
// 
this.btn\u ChangeLanguage.Image=global::WindowsFormsApplication1.Properties.Resources.flag\u cze\u mini;
resources.ApplyResources(this.btn_ChangeLanguage,“btn_ChangeLanguage”);
this.btn\u ChangeLanguage.Name=“btn\u ChangeLanguage”;
this.btn_ChangeLanguage.UseVisualStyleBackColor=true;
this.btn\u ChangeLanguage.Click+=新建System.EventHandler(this.btn\u ChangeLanguage\u Click);
this.btn_ChangeLanguage.MouseEnter+=新的System.EventHandler(this.Zobraz_Nastaveni_MouseEnter);
this.btn_ChangeLanguage.MouseLeave+=新系统.EventHandler(this.Zobraz_Nastaveni_MouseLeave);
// 
//pictureBox1
// 
this.pictureBox1.BackColor=System.Drawing.Color.Transparent;
this.pictureBox1.Image=global::WindowsFormsApplication1.Properties.Resources.trojuhelnik;
resources.ApplyResources(this.pictureBox1,“pictureBox1”);
this.pictureBox1.Name=“pictureBox1”;
this.pictureBox1.TabStop=false;
// 
//佐布拉兹·帕卢布卡
// 
this.Zobraz_Palubka.Image=global::WindowsFormsApplication1.Properties.Resources.tachometer_mini;
资源。ApplyResources(this.Zobraz_Palubka,“Zobraz_Palubka”);
this.Zobraz_Palubka.Name=“Zobraz_Palubka”;
this.Zobraz_Palubka.UseVisualStyleBackColor=true;
this.Zobraz_Palubka.Click+=new System.EventHandler(this.Zobraz_Click);
this.Zobraz_Palubka.MouseEnter+=新系统.EventHandler(this.Zobraz_Nastaveni_MouseEnter);
this.Zobraz_Palubka.MouseLeave+=新系统.EventHandler(this.Zobraz_Nastaveni_MouseLeave);
// 
//佐布拉兹·维齐
// 
this.Zobraz_Verzi.Image=global::WindowsFormsApplication1.Properties.Resources.info_mini;
资源。ApplyResources(this.Zobraz_Verzi,“Zobraz_Verzi”);
this.Zobraz_Verzi.Name=“Zobraz_Verzi”;
this.Zobraz_Verzi.UseVisualStyleBackColor=true;
this.Zobraz_Verzi.Click+=new System.EventHandler(this.Zobraz_Click);
this.Zobraz_Verzi.MouseEnter+=新系统.EventHandler(this.Zobraz_Nastaveni_MouseEnter);
this.Zobraz_Verzi.MouseLeave+=新系统.EventHandler(this.Zobraz_Nastaveni_MouseLeave);
// 
//Zobraz_误差
// 
this.Zobraz_error.Image=global::WindowsFormsApplication1.Properties.Resources.error1_mini;
resources.ApplyResources(this.Zobraz_error,“Zobraz_error”);
this.Zobraz_error.Name=“Zobraz_error”;
this.Zobraz_error.UseVisualStyleBackColor=true;
this.Zobraz_error.Click+=new System.EventHandler(this.Zobraz_Click);
this.Zobraz_error.MouseEnter+=新系统.EventHandler(this.Zobraz_Nastaveni_MouseEnter);
this.Zobraz_error.MouseLeave+=新系统.EventHandler(this.Zobraz_Nastaven