⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgfrmchangepassword.cs

📁 报刊广告管理系统。CSharp编写
💻 CS
字号:
using System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Windows.Forms;namespace WWAM.Forms.Dlg{	public class DlgFrmChangePassword : WWAM.Forms.Dlg.DlgBase	{
		#region DlgFrmChangePassword
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private DevExpress.XtraEditors.TextEdit txtOldPassword;
		private DevExpress.XtraEditors.TextEdit txtNewPassword;
		private DevExpress.XtraEditors.TextEdit txtCheckPassword;		private System.ComponentModel.IContainer components = null;		public DlgFrmChangePassword()		{			// 该调用是 Windows 窗体设计器所必需的。			InitializeComponent();			// TODO: 在 InitializeComponent 调用后添加任何初始化		}		public DlgFrmChangePassword(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.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.txtOldPassword = new DevExpress.XtraEditors.TextEdit();
			this.txtNewPassword = new DevExpress.XtraEditors.TextEdit();
			this.txtCheckPassword = new DevExpress.XtraEditors.TextEdit();
			((System.ComponentModel.ISupportInitialize)(this.txtOldPassword.Properties)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.txtNewPassword.Properties)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.txtCheckPassword.Properties)).BeginInit();
			this.SuspendLayout();
			// 
			// btnAccept
			// 
			this.btnAccept.Location = new System.Drawing.Point(80, 136);
			this.btnAccept.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
			this.btnAccept.LookAndFeel.UseWindowsXPTheme = false;
			this.btnAccept.Name = "btnAccept";
			this.btnAccept.TabIndex = 3;
			// 
			// btnCancel
			// 
			this.btnCancel.Location = new System.Drawing.Point(176, 136);
			this.btnCancel.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Skin;
			this.btnCancel.LookAndFeel.UseWindowsXPTheme = false;
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.TabIndex = 4;
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(72, 24);
			this.label1.TabIndex = 2;
			this.label1.Text = "原密码:";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(16, 56);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(72, 24);
			this.label2.TabIndex = 3;
			this.label2.Text = "新密码:";
			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(16, 96);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(72, 24);
			this.label3.TabIndex = 4;
			this.label3.Text = "密码确认:";
			this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// txtOldPassword
			// 
			this.txtOldPassword.EditValue = "";
			this.txtOldPassword.EnterMoveNextControl = true;
			this.txtOldPassword.Location = new System.Drawing.Point(88, 16);
			this.txtOldPassword.Name = "txtOldPassword";
			// 
			// txtOldPassword.Properties
			// 
			this.txtOldPassword.Properties.AppearanceFocused.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(224)), ((System.Byte)(192)));
			this.txtOldPassword.Properties.AppearanceFocused.Options.UseBackColor = true;
			this.txtOldPassword.Properties.PasswordChar = '*';
			this.txtOldPassword.Size = new System.Drawing.Size(160, 21);
			this.txtOldPassword.TabIndex = 0;
			this.txtOldPassword.EditValueChanged += new System.EventHandler(this.EditValueChanged);
			// 
			// txtNewPassword
			// 
			this.txtNewPassword.EditValue = "";
			this.txtNewPassword.EnterMoveNextControl = true;
			this.txtNewPassword.Location = new System.Drawing.Point(88, 56);
			this.txtNewPassword.Name = "txtNewPassword";
			// 
			// txtNewPassword.Properties
			// 
			this.txtNewPassword.Properties.AppearanceFocused.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(224)), ((System.Byte)(192)));
			this.txtNewPassword.Properties.AppearanceFocused.Options.UseBackColor = true;
			this.txtNewPassword.Properties.PasswordChar = '*';
			this.txtNewPassword.Size = new System.Drawing.Size(160, 21);
			this.txtNewPassword.TabIndex = 1;
			this.txtNewPassword.EditValueChanged += new System.EventHandler(this.EditValueChanged);
			// 
			// txtCheckPassword
			// 
			this.txtCheckPassword.EditValue = "";
			this.txtCheckPassword.EnterMoveNextControl = true;
			this.txtCheckPassword.Location = new System.Drawing.Point(88, 96);
			this.txtCheckPassword.Name = "txtCheckPassword";
			// 
			// txtCheckPassword.Properties
			// 
			this.txtCheckPassword.Properties.AppearanceFocused.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(224)), ((System.Byte)(192)));
			this.txtCheckPassword.Properties.AppearanceFocused.Options.UseBackColor = true;
			this.txtCheckPassword.Properties.PasswordChar = '*';
			this.txtCheckPassword.Size = new System.Drawing.Size(160, 21);
			this.txtCheckPassword.TabIndex = 2;
			this.txtCheckPassword.EditValueChanged += new System.EventHandler(this.EditValueChanged);
			// 
			// DlgFrmChangePassword
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(266, 176);
			this.Controls.Add(this.txtCheckPassword);
			this.Controls.Add(this.txtNewPassword);
			this.Controls.Add(this.txtOldPassword);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label1);
			this.Name = "DlgFrmChangePassword";
			this.Text = "修改密码";
			this.Controls.SetChildIndex(this.label1, 0);
			this.Controls.SetChildIndex(this.btnCancel, 0);
			this.Controls.SetChildIndex(this.btnAccept, 0);
			this.Controls.SetChildIndex(this.label2, 0);
			this.Controls.SetChildIndex(this.label3, 0);
			this.Controls.SetChildIndex(this.txtOldPassword, 0);
			this.Controls.SetChildIndex(this.txtNewPassword, 0);
			this.Controls.SetChildIndex(this.txtCheckPassword, 0);
			((System.ComponentModel.ISupportInitialize)(this.txtOldPassword.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtNewPassword.Properties)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.txtCheckPassword.Properties)).EndInit();
			this.ResumeLayout(false);

		}		#endregion		#endregion
		#region Variable && Property		string oldPassword;		public string NewPassword		{			get			{				return WWAM.BLL.Verify.LocalEncodeString(this.txtNewPassword.Text.Trim());			}		}		#endregion		#region CanClose		protected override bool CanClose()
		{
			if(ControlEmpty(this.txtOldPassword,"请输入原密码"))return false;
			if(ControlEmpty(this.txtNewPassword,"请输入新密码"))return false;
			if(ControlEmpty(this.txtCheckPassword,"请确认新密码"))return false;
			if(WWAM.BLL.Verify.LocalEncodeString(this.txtOldPassword.Text.Trim())!=oldPassword)
			{
				this.txtOldPassword.ToolTipController.ShowHint("原密码不正确!");
				this.txtOldPassword.Focus();
				return false;
			}
			if(this.txtNewPassword.Text.Trim()!=this.txtCheckPassword.Text.Trim())
			{
				this.txtNewPassword.ToolTipController.ShowHint("密码确认不一致!");
				this.txtNewPassword.Focus();
				return false;
			}
			return base.CanClose ();
		}
		#endregion		#region OnFormShow		protected override void OnFormShow()
		{
			base.OnFormShow ();
			this.txtOldPassword.Focus();
		}		#endregion		#region ShowDialog		public DialogResult ShowDialog(string oldpass)		{			this.oldPassword = oldpass;			return base.ShowDialog();		}		#endregion
		#region EditValueChanged		private void EditValueChanged(object sender, System.EventArgs e)
		{
			((DevExpress.XtraEditors.BaseControl)sender).ToolTip = "";		}		#endregion	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -