📄 frmset.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using HouseBE;
using HouseBS;
namespace frmLogin
{
/// <summary>
/// frmSet 的摘要说明。
/// </summary>
public class frmSet : System.Windows.Forms.Form
{
private DevComponents.DotNetBar.ButtonX buttonX2;
private DevComponents.DotNetBar.ButtonX buttonX1;
private DevComponents.DotNetBar.Controls.TextBoxX textBoxX2;
private DevComponents.DotNetBar.Controls.TextBoxX textBoxX1;
private DevComponents.DotNetBar.LabelX labelX2;
private DevComponents.DotNetBar.LabelX labelX1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private HouseBE.Login _login;
private HouseBS.LoginBS _logins;
public frmSet()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this._logins=new LoginBS();
//
// 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()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmSet));
this.buttonX2 = new DevComponents.DotNetBar.ButtonX();
this.buttonX1 = new DevComponents.DotNetBar.ButtonX();
this.textBoxX2 = new DevComponents.DotNetBar.Controls.TextBoxX();
this.textBoxX1 = new DevComponents.DotNetBar.Controls.TextBoxX();
this.labelX2 = new DevComponents.DotNetBar.LabelX();
this.labelX1 = new DevComponents.DotNetBar.LabelX();
this.SuspendLayout();
//
// buttonX2
//
this.buttonX2.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.buttonX2.Location = new System.Drawing.Point(168, 128);
this.buttonX2.Name = "buttonX2";
this.buttonX2.Size = new System.Drawing.Size(80, 33);
this.buttonX2.TabIndex = 11;
this.buttonX2.Text = "退出";
this.buttonX2.Click += new System.EventHandler(this.buttonX2_Click);
//
// buttonX1
//
this.buttonX1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.buttonX1.Location = new System.Drawing.Point(54, 127);
this.buttonX1.Name = "buttonX1";
this.buttonX1.Size = new System.Drawing.Size(82, 33);
this.buttonX1.TabIndex = 10;
this.buttonX1.Text = "添加";
this.buttonX1.Click += new System.EventHandler(this.buttonX1_Click);
//
// textBoxX2
//
this.textBoxX2.AutoSize = false;
//
// textBoxX2.Border
//
this.textBoxX2.Border.Class = "TextBoxBorder";
this.textBoxX2.Location = new System.Drawing.Point(128, 79);
this.textBoxX2.Name = "textBoxX2";
this.textBoxX2.Size = new System.Drawing.Size(136, 21);
this.textBoxX2.TabIndex = 9;
//
// textBoxX1
//
this.textBoxX1.AutoSize = false;
//
// textBoxX1.Border
//
this.textBoxX1.Border.Class = "TextBoxBorder";
this.textBoxX1.Location = new System.Drawing.Point(128, 24);
this.textBoxX1.Name = "textBoxX1";
this.textBoxX1.Size = new System.Drawing.Size(136, 21);
this.textBoxX1.TabIndex = 8;
//
// labelX2
//
this.labelX2.Location = new System.Drawing.Point(30, 79);
this.labelX2.Name = "labelX2";
this.labelX2.Size = new System.Drawing.Size(75, 23);
this.labelX2.TabIndex = 7;
this.labelX2.Text = "<b>口令:</b>";
//
// labelX1
//
this.labelX1.Location = new System.Drawing.Point(30, 23);
this.labelX1.Name = "labelX1";
this.labelX1.Size = new System.Drawing.Size(75, 23);
this.labelX1.TabIndex = 6;
this.labelX1.Text = "<b>用户名:</b>";
//
// frmSet
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(296, 181);
this.Controls.Add(this.buttonX2);
this.Controls.Add(this.buttonX1);
this.Controls.Add(this.textBoxX2);
this.Controls.Add(this.textBoxX1);
this.Controls.Add(this.labelX2);
this.Controls.Add(this.labelX1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmSet";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "用户设置";
this.ResumeLayout(false);
}
#endregion
private void buttonX2_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void buttonX1_Click(object sender, System.EventArgs e)
{
if(this.textBoxX1.Text.Length<1||this.textBoxX2.Text.Length<1)
{
MessageBox.Show("请将资料填写完整");
return ;
}
this._login=new Login();
this._login.LoginName=this.textBoxX1.Text;
this._login.LoginPwd=this.textBoxX2.Text;
try
{
this._logins.login=this._login;
this._logins.insert();
MessageBox.Show("添加成功!");
this.textBoxX1.Text="";
this.textBoxX2.Text="";
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -