📄 frmsetshared.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace FileSystem
{
/// <summary>
/// FrmSetShared 的摘要说明。
/// </summary>
public class FrmSetShared : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
public System.Windows.Forms.Label lbFolderName;
public System.Windows.Forms.RadioButton rdbNotSahred;
public System.Windows.Forms.RadioButton rdbShared;
public System.Windows.Forms.GroupBox gbSetPassWord;
public System.Windows.Forms.CheckBox cbSetPassWord;
public System.Windows.Forms.TextBox tbPassWord1;
public System.Windows.Forms.TextBox tbPassWord2;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public FrmSetShared()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.lbFolderName = new System.Windows.Forms.Label();
this.rdbNotSahred = new System.Windows.Forms.RadioButton();
this.rdbShared = new System.Windows.Forms.RadioButton();
this.gbSetPassWord = new System.Windows.Forms.GroupBox();
this.tbPassWord2 = new System.Windows.Forms.TextBox();
this.tbPassWord1 = new System.Windows.Forms.TextBox();
this.cbSetPassWord = new System.Windows.Forms.CheckBox();
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.gbSetPassWord.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 24);
this.label1.Name = "label1";
this.label1.TabIndex = 0;
this.label1.Text = "共享的文件夹:";
//
// lbFolderName
//
this.lbFolderName.Location = new System.Drawing.Point(128, 24);
this.lbFolderName.Name = "lbFolderName";
this.lbFolderName.Size = new System.Drawing.Size(152, 23);
this.lbFolderName.TabIndex = 1;
//
// rdbNotSahred
//
this.rdbNotSahred.Location = new System.Drawing.Point(16, 72);
this.rdbNotSahred.Name = "rdbNotSahred";
this.rdbNotSahred.TabIndex = 2;
this.rdbNotSahred.Text = "不共享";
this.rdbNotSahred.CheckedChanged += new System.EventHandler(this.rdbNotSahred_CheckedChanged);
//
// rdbShared
//
this.rdbShared.Location = new System.Drawing.Point(16, 104);
this.rdbShared.Name = "rdbShared";
this.rdbShared.TabIndex = 3;
this.rdbShared.Text = "共享";
this.rdbShared.CheckedChanged += new System.EventHandler(this.rdbShared_CheckedChanged);
//
// gbSetPassWord
//
this.gbSetPassWord.Controls.Add(this.tbPassWord2);
this.gbSetPassWord.Controls.Add(this.tbPassWord1);
this.gbSetPassWord.Controls.Add(this.cbSetPassWord);
this.gbSetPassWord.Controls.Add(this.label2);
this.gbSetPassWord.Controls.Add(this.label3);
this.gbSetPassWord.Location = new System.Drawing.Point(32, 136);
this.gbSetPassWord.Name = "gbSetPassWord";
this.gbSetPassWord.Size = new System.Drawing.Size(240, 120);
this.gbSetPassWord.TabIndex = 4;
this.gbSetPassWord.TabStop = false;
//
// tbPassWord2
//
this.tbPassWord2.Location = new System.Drawing.Point(80, 80);
this.tbPassWord2.Name = "tbPassWord2";
this.tbPassWord2.PasswordChar = '*';
this.tbPassWord2.Size = new System.Drawing.Size(144, 21);
this.tbPassWord2.TabIndex = 2;
this.tbPassWord2.Text = "";
//
// tbPassWord1
//
this.tbPassWord1.Location = new System.Drawing.Point(80, 48);
this.tbPassWord1.Name = "tbPassWord1";
this.tbPassWord1.PasswordChar = '*';
this.tbPassWord1.Size = new System.Drawing.Size(144, 21);
this.tbPassWord1.TabIndex = 1;
this.tbPassWord1.Text = "";
//
// cbSetPassWord
//
this.cbSetPassWord.Location = new System.Drawing.Point(16, 16);
this.cbSetPassWord.Name = "cbSetPassWord";
this.cbSetPassWord.TabIndex = 0;
this.cbSetPassWord.Text = "设置密码";
this.cbSetPassWord.CheckedChanged += new System.EventHandler(this.cbSetPassWord_CheckedChanged);
//
// btnOk
//
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOk.Location = new System.Drawing.Point(56, 280);
this.btnOk.Name = "btnOk";
this.btnOk.TabIndex = 5;
this.btnOk.Text = "确定";
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(160, 280);
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 6;
this.btnCancel.Text = "取消";
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 48);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(48, 23);
this.label2.TabIndex = 7;
this.label2.Text = "密码:";
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 80);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(48, 23);
this.label3.TabIndex = 7;
this.label3.Text = "确认:";
//
// FrmSetShared
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 327);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.gbSetPassWord);
this.Controls.Add(this.rdbShared);
this.Controls.Add(this.rdbNotSahred);
this.Controls.Add(this.lbFolderName);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmSetShared";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "共享文件夹设置";
this.gbSetPassWord.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void rdbNotSahred_CheckedChanged(object sender, System.EventArgs e)
{
gbSetPassWord.Enabled=false;
cbSetPassWord.Checked=false;
tbPassWord1.Text="";
tbPassWord1.Enabled=false;
tbPassWord2.Text="";
tbPassWord2.Enabled=false;
}
private void rdbShared_CheckedChanged(object sender, System.EventArgs e)
{
gbSetPassWord.Enabled=true;
}
private void cbSetPassWord_CheckedChanged(object sender, System.EventArgs e)
{
if(cbSetPassWord.Checked==true)
{
tbPassWord1.Enabled=true;
tbPassWord2.Enabled=true;
}
else
{
tbPassWord1.Enabled=false;
tbPassWord2.Enabled=false;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -