Files
IOT_SIM/samples/p1-t1-登录/Login.Designer.cs
T
xuyueandClaude Opus 5.5 8feda289de 多窗体:新建 / 删除窗体,项目 1 登录示例;标识符支持中文
- 新建窗体:生成与 VS 新建窗体相同的 X.cs 和 X.Designer.cs,沿用工程命名空间;
  删除窗体(启动窗体不能删)
- 标签页按窗体分组,启动窗体排在最前并默认打开
- 运行时点哪个窗口哪个到最前;消息框始终在所有窗口之上
- 示例:项目 1 任务 1 登录与增加用户,两个窗体的 Designer.cs 由设计器引擎生成;
  修正书上未声明的 change 变量、关闭后重复 Show 已释放窗体的问题
- 设计器的正则支持中文控件名、类名、命名空间
- 修正:切换窗体时属性窗口的名称没有刷新
- 测试:多窗体端到端测试;新窗体模板测试

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 11:23:37 +08:00

134 lines
5.2 KiB
C#

namespace 登录
{
partial class Login
{
/// <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.LblUsername = new System.Windows.Forms.Label();
this.txtUserName = new System.Windows.Forms.TextBox();
this.LblPwd = new System.Windows.Forms.Label();
this.txtPassword = new System.Windows.Forms.TextBox();
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnAdd = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// LblUsername
//
this.LblUsername.AutoSize = true;
this.LblUsername.Location = new System.Drawing.Point(30, 30);
this.LblUsername.Name = "LblUsername";
this.LblUsername.Size = new System.Drawing.Size(53, 12);
this.LblUsername.TabIndex = 0;
this.LblUsername.Text = "用户名称";
//
// txtUserName
//
this.txtUserName.Location = new System.Drawing.Point(100, 27);
this.txtUserName.Name = "txtUserName";
this.txtUserName.Size = new System.Drawing.Size(160, 21);
this.txtUserName.TabIndex = 1;
//
// LblPwd
//
this.LblPwd.AutoSize = true;
this.LblPwd.Location = new System.Drawing.Point(30, 66);
this.LblPwd.Name = "LblPwd";
this.LblPwd.Size = new System.Drawing.Size(29, 12);
this.LblPwd.TabIndex = 2;
this.LblPwd.Text = "密码";
//
// txtPassword
//
this.txtPassword.Location = new System.Drawing.Point(100, 63);
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '*';
this.txtPassword.Size = new System.Drawing.Size(160, 21);
this.txtPassword.TabIndex = 3;
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(30, 105);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 4;
this.btnOk.Text = "登录";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(115, 105);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 5;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnAdd
//
this.btnAdd.Location = new System.Drawing.Point(200, 105);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(75, 23);
this.btnAdd.TabIndex = 6;
this.btnAdd.Text = "增加用户";
this.btnAdd.UseVisualStyleBackColor = true;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// Login
//
this.AcceptButton = this.btnOk;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(300, 150);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.LblPwd);
this.Controls.Add(this.txtUserName);
this.Controls.Add(this.LblUsername);
this.Name = "Login";
this.Text = "登录";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label LblUsername;
private System.Windows.Forms.TextBox txtUserName;
private System.Windows.Forms.Label LblPwd;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnAdd;
}
}