我不明白这段代码? [英] i don't understand this code ?

查看:62
本文介绍了我不明白这段代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  部分课程NQueen

    {

  &NBSP; &NBSP; &NBSP; ///< summary>

  &NBSP; &NBSP; &NBSP; ///所需的设计师变量。

  &NBSP; &NBSP; &NBSP; ///< / summary>

  &NBSP; &NBSP; &NBSP; private System.ComponentModel.IContainer components = null;



  &NBSP; &NBSP; &NBSP; ///< summary>

  &NBSP; &NBSP; &NBSP; ///清理正在使用的所有资源。

  &NBSP; &NBSP; &NBSP; ///< / summary>

  &NBSP; &NBSP; &NBSP; ///< param name =" disposing">如果应该处理托管资源,则为true;否则,为假。< / param>

  &NBSP; &NBSP; &NBSP; protected override void Dispose(bool disposing)

  &NBSP; &NBSP; &NBSP; {

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; if(disposing&&(components!= null))

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; {

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; components.Dispose();

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; }¥b $ b  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; base.Dispose(disposing);

  &NBSP; &NBSP; &NBSP; }


  &NBSP; &NBSP; &NBSP; #region Windows窗体设计器生成的代码



  &NBSP; &NBSP; &NBSP; ///< summary>

  &NBSP; &NBSP; &NBSP; ///支持Designer的必需方法 - 请勿修改

  &NBSP; &NBSP; &NBSP; ///使用代码编辑器的方法内容。

  &NBSP; &NBSP; &NBSP; ///< / summary>

  &NBSP; &NBSP; &NBSP; private void InitializeComponent()

  &NBSP; &NBSP; &NBSP; {

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.components = new System.ComponentModel.Container();

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnSolve = new System.Windows.Forms.Button();

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.pnlChess = new System.Windows.Forms.Panel();

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

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.txtN = new System.Windows.Forms.TextBox();

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.timerStep = new System.Windows.Forms.Timer(this.components);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnStop = new System.Windows.Forms.Button();

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.SuspendLayout();

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // btnSolve

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnSolve.Location = new System.Drawing.Point(208,36);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnSolve.Name =" btnSolve";

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnSolve.Size = new System.Drawing.Size(216,33);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnSolve.TabIndex = 0;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnSolve.Text =" Start Solving"; $
  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnSolve.UseVisualStyleBackColor = true;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnSolve.Click + = new System.EventHandler(this.btnSolve_Click);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // pnlChess

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.pnlChess.Location = new System.Drawing.Point(29,73);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.pnlChess.Name =" pnlChess";

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.pnlChess.Size = new System.Drawing.Size(550,550);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.pnlChess.TabIndex = 1;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // label1

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.label1.AutoSize = true;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.label1.Location = new System.Drawing.Point(205,9);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.label1.Name =" label1";

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.label1.Size = new System.Drawing.Size(73,13);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.label1.TabIndex = 2;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.label1.Text =" Queen Count:";

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // txtN

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.txtN.Location = new System.Drawing.Point(276,9);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.txtN.Name =" txtN";

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.txtN.Size = new System.Drawing.Size(148,20);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.txtN.TabIndex = 3;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // timerStep

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.timerStep.Interval = 300;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.timerStep.Tick + = new System.EventHandler(this.timerStep_Tick);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // btnStop

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnStop.Location = new System.Drawing.Point(29,36);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnStop.Name =" btnStop";

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnStop.Size = new System.Drawing.Size(147,33);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnStop.TabIndex = 4;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnStop.Text =" Stop Solving"; $
  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnStop.UseVisualStyleBackColor = true;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.btnStop.Click + = new System.EventHandler(this.btnStop_Click);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // NQueen

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; // 

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.AutoScaleDimensions = new System.Drawing.SizeF(6F,13F);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.ClientSize = new System.Drawing.Size(604,637);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.Controls.Add(this.btnStop);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.Controls.Add(this.txtN);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.Controls.Add(this.label1);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.Controls.Add(this.pnlChess);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.Controls.Add(this.btnSolve);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.MaximizeBox = false;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.Name =" NQueen";

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.Text ="N Queen Problem - BFS";

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.ResumeLayout(false);

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; this.PerformLayout();



  &NBSP; &NBSP; &NBSP; }


  &NBSP; &NBSP; &NBSP; #endregion



  &NBSP; &NBSP; &NBSP; private System.Windows.Forms.Button btnSolve;

  &NBSP; &NBSP; &NBSP; private System.Windows.Forms.Panel pnlChess;

  &NBSP; &NBSP; &NBSP; private System.Windows.Forms.Label label1;

  &NBSP; &NBSP; &NBSP; private System.Windows.Forms.TextBox txtN;

  &NBSP; &NBSP; &NBSP; private System.Windows.Forms.Timer timerStep;

  &NBSP; &NBSP; &NBSP; private System.Windows.Forms.Button btnStop;

  &NBSP; }
}

解决方案

此代码似乎来自Visual Studio生成的.designer.cs文件当你在屏幕上设计一个表单时。


它本质上是它创建了一个你添加到设计器中的每个控件的实例,并将这些实例添加到了控件的集合中。表单。


当它在运行时执行时,结果是每个控件都由Form类在屏幕上呈现。


如果你的问题是关于代码中的某个特定部分,请稍微改进一下(例如,'what表示"部分",或"什么是#region"或"为什么我们在底部有所有私有声明",等)


  partial class NQueen
    {
        /// <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.components = new System.ComponentModel.Container();
            this.btnSolve = new System.Windows.Forms.Button();
            this.pnlChess = new System.Windows.Forms.Panel();
            this.label1 = new System.Windows.Forms.Label();
            this.txtN = new System.Windows.Forms.TextBox();
            this.timerStep = new System.Windows.Forms.Timer(this.components);
            this.btnStop = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // btnSolve
            // 
            this.btnSolve.Location = new System.Drawing.Point(208, 36);
            this.btnSolve.Name = "btnSolve";
            this.btnSolve.Size = new System.Drawing.Size(216, 33);
            this.btnSolve.TabIndex = 0;
            this.btnSolve.Text = "Start Solving";
            this.btnSolve.UseVisualStyleBackColor = true;
            this.btnSolve.Click += new System.EventHandler(this.btnSolve_Click);
            // 
            // pnlChess
            // 
            this.pnlChess.Location = new System.Drawing.Point(29, 73);
            this.pnlChess.Name = "pnlChess";
            this.pnlChess.Size = new System.Drawing.Size(550, 550);
            this.pnlChess.TabIndex = 1;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(205, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(73, 13);
            this.label1.TabIndex = 2;
            this.label1.Text = "Queen Count:";
            // 
            // txtN
            // 
            this.txtN.Location = new System.Drawing.Point(276, 9);
            this.txtN.Name = "txtN";
            this.txtN.Size = new System.Drawing.Size(148, 20);
            this.txtN.TabIndex = 3;
            // 
            // timerStep
            // 
            this.timerStep.Interval = 300;
            this.timerStep.Tick += new System.EventHandler(this.timerStep_Tick);
            // 
            // btnStop
            // 
            this.btnStop.Location = new System.Drawing.Point(29, 36);
            this.btnStop.Name = "btnStop";
            this.btnStop.Size = new System.Drawing.Size(147, 33);
            this.btnStop.TabIndex = 4;
            this.btnStop.Text = "Stop Solving";
            this.btnStop.UseVisualStyleBackColor = true;
            this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
            // 
            // NQueen
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(604, 637);
            this.Controls.Add(this.btnStop);
            this.Controls.Add(this.txtN);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.pnlChess);
            this.Controls.Add(this.btnSolve);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.Name = "NQueen";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "N Queen Problem - BFS";
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button btnSolve;
        private System.Windows.Forms.Panel pnlChess;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox txtN;
        private System.Windows.Forms.Timer timerStep;
        private System.Windows.Forms.Button btnStop;
    }
}

解决方案

This code appears to be from the .designer.cs file generated by Visual Studio when you design a form on screen.

Essentially, what it does is that it creates an instance of every control that you added to the designer, and add those instances to the Controls collection of the form.

When it is executed at runtime, the result is that each of these controls is rendered on screen by the Form class.

If your question is about some specific part in the code, please refine it a bit (for instance, 'what means "partial"', or 'what is #region' or 'why do we have all the private declarations at the bottom', etc.)


这篇关于我不明白这段代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆