📄 password.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace ExcelObjectModelCS
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Password : System.Windows.Forms.Form
{
internal System.Windows.Forms.Label Label1;
internal System.Windows.Forms.Button btnCancel;
internal System.Windows.Forms.Button btnOK;
internal System.Windows.Forms.TextBox txtPassword;
internal System.Windows.Forms.Label Label2;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Password()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(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.Label1 = new System.Windows.Forms.Label();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.txtPassword = new System.Windows.Forms.TextBox();
this.Label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// Label1
//
this.Label1.Location = new System.Drawing.Point(24, 40);
this.Label1.Name = "Label1";
this.Label1.Size = new System.Drawing.Size(184, 16);
this.Label1.TabIndex = 12;
this.Label1.Text = "(Leave blank to clear password)";
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(240, 32);
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 11;
this.btnCancel.Text = "Cancel";
//
// btnOK
//
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(240, 8);
this.btnOK.Name = "btnOK";
this.btnOK.TabIndex = 10;
this.btnOK.Text = "OK";
//
// txtPassword
//
this.txtPassword.Location = new System.Drawing.Point(88, 16);
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '*';
this.txtPassword.Size = new System.Drawing.Size(128, 20);
this.txtPassword.TabIndex = 9;
this.txtPassword.Text = "";
//
// Label2
//
this.Label2.Location = new System.Drawing.Point(16, 16);
this.Label2.Name = "Label2";
this.Label2.Size = new System.Drawing.Size(64, 23);
this.Label2.TabIndex = 8;
this.Label2.Text = "Password:";
this.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// Form1
//
this.AcceptButton = this.btnOK;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(320, 61);
this.Controls.Add(this.Label1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.Label2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.Text = "Enter New Password";
this.ResumeLayout(false);
}
#endregion
public string Value
{
get
{
return txtPassword.Text;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -