- 界面取自配套参考工程,用设计器引擎按书上表格改控件名(label1 → lbl_port 等), 去掉 BOM、换行统一为 LF;代码按书整理,修正 boolIsOpen 等印刷错误 - 测试:所有示例都能编译(10 个),以及计算器 / 多态、红外对射、报警灯、火焰的行为测试 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
163 lines
6.5 KiB
C#
163 lines
6.5 KiB
C#
namespace C_基础
|
|
{
|
|
partial class Form1
|
|
{
|
|
/// <summary>
|
|
/// 必需的设计器变量。
|
|
/// </summary>
|
|
private System.ComponentModel.IContainer components = null;
|
|
|
|
/// <summary>
|
|
/// 清理所有正在使用的资源。
|
|
/// </summary>
|
|
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing && (components != null))
|
|
{
|
|
components.Dispose();
|
|
}
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
#region Windows 窗体设计器生成的代码
|
|
|
|
/// <summary>
|
|
/// 设计器支持所需的方法 - 不要
|
|
/// 使用代码编辑器修改此方法的内容。
|
|
/// </summary>
|
|
private void InitializeComponent()
|
|
{
|
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
|
this.btnCalculate = new System.Windows.Forms.Button();
|
|
this.txtResult = new System.Windows.Forms.TextBox();
|
|
this.cmboxType = new System.Windows.Forms.ComboBox();
|
|
this.txtNum2 = new System.Windows.Forms.TextBox();
|
|
this.txtNum1 = new System.Windows.Forms.TextBox();
|
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
|
this.txtDispaly = new System.Windows.Forms.TextBox();
|
|
this.btnDisplay = new System.Windows.Forms.Button();
|
|
this.groupBox1.SuspendLayout();
|
|
this.groupBox2.SuspendLayout();
|
|
this.SuspendLayout();
|
|
//
|
|
// groupBox1
|
|
//
|
|
this.groupBox1.Controls.Add(this.btnCalculate);
|
|
this.groupBox1.Controls.Add(this.txtResult);
|
|
this.groupBox1.Controls.Add(this.cmboxType);
|
|
this.groupBox1.Controls.Add(this.txtNum2);
|
|
this.groupBox1.Controls.Add(this.txtNum1);
|
|
this.groupBox1.Location = new System.Drawing.Point(21, 12);
|
|
this.groupBox1.Name = "groupBox1";
|
|
this.groupBox1.Size = new System.Drawing.Size(516, 80);
|
|
this.groupBox1.TabIndex = 0;
|
|
this.groupBox1.TabStop = false;
|
|
this.groupBox1.Text = "简易计算器";
|
|
//
|
|
// btnCalculate
|
|
//
|
|
this.btnCalculate.Location = new System.Drawing.Point(325, 31);
|
|
this.btnCalculate.Name = "btnCalculate";
|
|
this.btnCalculate.Size = new System.Drawing.Size(49, 23);
|
|
this.btnCalculate.TabIndex = 5;
|
|
this.btnCalculate.Text = "=";
|
|
this.btnCalculate.UseVisualStyleBackColor = true;
|
|
this.btnCalculate.Click += new System.EventHandler(this.btnCalculate_Click);
|
|
//
|
|
// txtResult
|
|
//
|
|
this.txtResult.Location = new System.Drawing.Point(390, 31);
|
|
this.txtResult.Name = "txtResult";
|
|
this.txtResult.ReadOnly = true;
|
|
this.txtResult.Size = new System.Drawing.Size(100, 21);
|
|
this.txtResult.TabIndex = 4;
|
|
//
|
|
// cmboxType
|
|
//
|
|
this.cmboxType.FormattingEnabled = true;
|
|
this.cmboxType.Items.AddRange(new object[] {
|
|
"+",
|
|
"-",
|
|
"*",
|
|
"/"});
|
|
this.cmboxType.Location = new System.Drawing.Point(112, 31);
|
|
this.cmboxType.Name = "cmboxType";
|
|
this.cmboxType.Size = new System.Drawing.Size(64, 20);
|
|
this.cmboxType.TabIndex = 2;
|
|
//
|
|
// txtNum2
|
|
//
|
|
this.txtNum2.Location = new System.Drawing.Point(195, 31);
|
|
this.txtNum2.Name = "txtNum2";
|
|
this.txtNum2.Size = new System.Drawing.Size(100, 21);
|
|
this.txtNum2.TabIndex = 1;
|
|
//
|
|
// txtNum1
|
|
//
|
|
this.txtNum1.Location = new System.Drawing.Point(6, 31);
|
|
this.txtNum1.Name = "txtNum1";
|
|
this.txtNum1.Size = new System.Drawing.Size(100, 21);
|
|
this.txtNum1.TabIndex = 0;
|
|
//
|
|
// groupBox2
|
|
//
|
|
this.groupBox2.Controls.Add(this.txtDispaly);
|
|
this.groupBox2.Controls.Add(this.btnDisplay);
|
|
this.groupBox2.Location = new System.Drawing.Point(21, 98);
|
|
this.groupBox2.Name = "groupBox2";
|
|
this.groupBox2.Size = new System.Drawing.Size(516, 116);
|
|
this.groupBox2.TabIndex = 1;
|
|
this.groupBox2.TabStop = false;
|
|
this.groupBox2.Text = "类的多态性";
|
|
//
|
|
// txtDispaly
|
|
//
|
|
this.txtDispaly.Location = new System.Drawing.Point(46, 20);
|
|
this.txtDispaly.Multiline = true;
|
|
this.txtDispaly.Name = "txtDispaly";
|
|
this.txtDispaly.Size = new System.Drawing.Size(249, 82);
|
|
this.txtDispaly.TabIndex = 1;
|
|
//
|
|
// btnDisplay
|
|
//
|
|
this.btnDisplay.Location = new System.Drawing.Point(344, 45);
|
|
this.btnDisplay.Name = "btnDisplay";
|
|
this.btnDisplay.Size = new System.Drawing.Size(75, 23);
|
|
this.btnDisplay.TabIndex = 0;
|
|
this.btnDisplay.Text = "显示";
|
|
this.btnDisplay.UseVisualStyleBackColor = true;
|
|
this.btnDisplay.Click += new System.EventHandler(this.btnDisplay_Click);
|
|
//
|
|
// Form1
|
|
//
|
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
this.ClientSize = new System.Drawing.Size(549, 226);
|
|
this.Controls.Add(this.groupBox2);
|
|
this.Controls.Add(this.groupBox1);
|
|
this.Name = "Form1";
|
|
this.Text = "C#入门基础";
|
|
this.groupBox1.ResumeLayout(false);
|
|
this.groupBox1.PerformLayout();
|
|
this.groupBox2.ResumeLayout(false);
|
|
this.groupBox2.PerformLayout();
|
|
this.ResumeLayout(false);
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
private System.Windows.Forms.GroupBox groupBox1;
|
|
private System.Windows.Forms.TextBox txtResult;
|
|
private System.Windows.Forms.ComboBox cmboxType;
|
|
private System.Windows.Forms.TextBox txtNum2;
|
|
private System.Windows.Forms.TextBox txtNum1;
|
|
private System.Windows.Forms.Button btnCalculate;
|
|
private System.Windows.Forms.GroupBox groupBox2;
|
|
private System.Windows.Forms.TextBox txtDispaly;
|
|
private System.Windows.Forms.Button btnDisplay;
|
|
}
|
|
}
|
|
|