📄 dlgfrmreg.cs
字号:
using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Windows.Forms;namespace WWAM.Forms.Dlg{ public class DlgFrmReg : WWAM.Forms.Dlg.DlgBase {
#region DlgFrmReg
private DevExpress.XtraEditors.TextEdit txtMachineNum;
private System.Windows.Forms.Label label1;
private DevExpress.XtraEditors.TextEdit txtVerify;
private System.Windows.Forms.Label label2; private System.ComponentModel.IContainer components = null; public DlgFrmReg() { // 该调用是 Windows 窗体设计器所必需的。 InitializeComponent(); // TODO: 在 InitializeComponent 调用后添加任何初始化 } public DlgFrmReg(Form form):base(form) { // 该调用是 Windows 窗体设计器所必需的。 InitializeComponent(); // TODO: 在 InitializeComponent 调用后添加任何初始化 } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region 设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.txtMachineNum = new DevExpress.XtraEditors.TextEdit();
this.label1 = new System.Windows.Forms.Label();
this.txtVerify = new DevExpress.XtraEditors.TextEdit();
this.label2 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.txtMachineNum.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.txtVerify.Properties)).BeginInit();
this.SuspendLayout();
//
// btnAccept
//
this.btnAccept.Location = new System.Drawing.Point(112, 136);
this.btnAccept.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
this.btnAccept.LookAndFeel.UseWindowsXPTheme = false;
this.btnAccept.Name = "btnAccept";
this.btnAccept.Text = "注 册";
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(216, 136);
this.btnCancel.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
this.btnCancel.LookAndFeel.UseWindowsXPTheme = false;
this.btnCancel.Name = "btnCancel";
//
// txtMachineNum
//
this.txtMachineNum.EditValue = "";
this.txtMachineNum.Location = new System.Drawing.Point(32, 40);
this.txtMachineNum.Name = "txtMachineNum";
//
// txtMachineNum.Properties
//
this.txtMachineNum.Properties.ReadOnly = true;
this.txtMachineNum.Size = new System.Drawing.Size(248, 21);
this.txtMachineNum.TabIndex = 2;
//
// label1
//
this.label1.Location = new System.Drawing.Point(32, 16);
this.label1.Name = "label1";
this.label1.TabIndex = 3;
this.label1.Text = "机器码:";
//
// txtVerify
//
this.txtVerify.EditValue = "";
this.txtVerify.Location = new System.Drawing.Point(32, 96);
this.txtVerify.Name = "txtVerify";
this.txtVerify.Size = new System.Drawing.Size(248, 21);
this.txtVerify.TabIndex = 4;
//
// label2
//
this.label2.Location = new System.Drawing.Point(32, 72);
this.label2.Name = "label2";
this.label2.TabIndex = 5;
this.label2.Text = "注册码:";
//
// DlgFrmReg
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(306, 176);
this.Controls.Add(this.label2);
this.Controls.Add(this.txtVerify);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtMachineNum);
this.Name = "DlgFrmReg";
this.Text = "系统注册";
this.Controls.SetChildIndex(this.txtMachineNum, 0);
this.Controls.SetChildIndex(this.label1, 0);
this.Controls.SetChildIndex(this.btnCancel, 0);
this.Controls.SetChildIndex(this.btnAccept, 0);
this.Controls.SetChildIndex(this.txtVerify, 0);
this.Controls.SetChildIndex(this.label2, 0);
((System.ComponentModel.ISupportInitialize)(this.txtMachineNum.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txtVerify.Properties)).EndInit();
this.ResumeLayout(false);
} #endregion #endregion
#region Variable
WWAM.Forms.Dlg.DlgFrmMsg msg;
#endregion
#region OnLoad protected override void OnLoad(EventArgs e)
{
base.OnLoad (e);
msg = new DlgFrmMsg(this);
} #endregion #region CanClose protected override bool CanClose()
{
if(this.txtVerify.Text.Trim()==string.Empty
||
!WWAM.BLL.Verify.CheckVerify(this.txtVerify.Text.Trim()))
{
this.txtVerify.Focus();
msg.ShowWarning("未注册成功!");
return false;
}
else
{
WWAM.BLL.Verify.SetLocalVerify(this.txtVerify.Text.Trim());
msg.ShowWarning("注册成功!");
}
return base.CanClose ();
}
#endregion
#region OnFormShow
protected override void OnFormShow()
{
base.OnFormShow ();
this.txtVerify.Focus();
}
#endregion
#region ShowDialog
public new DialogResult ShowDialog()
{
this.txtMachineNum.Text = WWAM.BLL.Verify.GetMachineNum();
return base.ShowDialog();
}
#endregion
}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -