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

📄 register.cs

📁 为湖北省教委、湖北省就业指导中心订做的学历查询系统
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace WindowsApplication3
{
	/// <summary>
	/// Register 的摘要说明。
	/// </summary>
	public class Register : System.Windows.Forms.Form
	{
		private System.Windows.Forms.TextBox txtName;
		private System.Windows.Forms.RadioButton rb1;
		private System.Windows.Forms.RadioButton rb2;
		private System.Windows.Forms.TextBox txtPosition;
		private System.Windows.Forms.TextBox txtPassword;
		private System.Windows.Forms.ToolTip ts;
		private System.Windows.Forms.PictureBox picOfReg;
		private System.Windows.Forms.DateTimePicker dtPicker;
		private System.ComponentModel.IContainer components;

		public Register()
		{
			//
			// 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.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Register));
			this.txtName = new System.Windows.Forms.TextBox();
			this.rb1 = new System.Windows.Forms.RadioButton();
			this.rb2 = new System.Windows.Forms.RadioButton();
			this.txtPosition = new System.Windows.Forms.TextBox();
			this.txtPassword = new System.Windows.Forms.TextBox();
			this.ts = new System.Windows.Forms.ToolTip(this.components);
			this.picOfReg = new System.Windows.Forms.PictureBox();
			this.dtPicker = new System.Windows.Forms.DateTimePicker();
			this.SuspendLayout();
			// 
			// txtName
			// 
			this.txtName.Location = new System.Drawing.Point(424, 120);
			this.txtName.Name = "txtName";
			this.txtName.Size = new System.Drawing.Size(112, 21);
			this.txtName.TabIndex = 0;
			this.txtName.Text = "";
			// 
			// rb1
			// 
			this.rb1.BackColor = System.Drawing.SystemColors.ControlLightLight;
			this.rb1.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.rb1.Location = new System.Drawing.Point(424, 144);
			this.rb1.Name = "rb1";
			this.rb1.Size = new System.Drawing.Size(32, 24);
			this.rb1.TabIndex = 2;
			this.rb1.TabStop = true;
			this.rb1.Text = "男";
			// 
			// rb2
			// 
			this.rb2.BackColor = System.Drawing.SystemColors.ControlLightLight;
			this.rb2.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.rb2.Location = new System.Drawing.Point(496, 144);
			this.rb2.Name = "rb2";
			this.rb2.Size = new System.Drawing.Size(32, 24);
			this.rb2.TabIndex = 6;
			this.rb2.Text = "女";
			// 
			// txtPosition
			// 
			this.txtPosition.Location = new System.Drawing.Point(424, 208);
			this.txtPosition.Name = "txtPosition";
			this.txtPosition.Size = new System.Drawing.Size(112, 21);
			this.txtPosition.TabIndex = 4;
			this.txtPosition.Text = "";
			// 
			// txtPassword
			// 
			this.txtPassword.Location = new System.Drawing.Point(424, 240);
			this.txtPassword.Name = "txtPassword";
			this.txtPassword.PasswordChar = '*';
			this.txtPassword.Size = new System.Drawing.Size(112, 21);
			this.txtPassword.TabIndex = 5;
			this.txtPassword.Text = "";
			// 
			// picOfReg
			// 
			this.picOfReg.Cursor = System.Windows.Forms.Cursors.Hand;
			this.picOfReg.Image = ((System.Drawing.Image)(resources.GetObject("picOfReg.Image")));
			this.picOfReg.Location = new System.Drawing.Point(480, 280);
			this.picOfReg.Name = "picOfReg";
			this.picOfReg.Size = new System.Drawing.Size(56, 24);
			this.picOfReg.TabIndex = 8;
			this.picOfReg.TabStop = false;
			this.picOfReg.Click += new System.EventHandler(this.picOfReg_Click);
			this.picOfReg.MouseEnter += new System.EventHandler(this.picOfReg_MouseEnter);
			this.picOfReg.MouseHover += new System.EventHandler(this.picOfReg_MouseHover);
			this.picOfReg.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picOfReg_MouseMove);
			this.picOfReg.MouseLeave += new System.EventHandler(this.picOfReg_MouseLeave);
			this.picOfReg.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picOfReg_MouseDown);
			// 
			// dtPicker
			// 
			this.dtPicker.Location = new System.Drawing.Point(424, 176);
			this.dtPicker.Name = "dtPicker";
			this.dtPicker.Size = new System.Drawing.Size(112, 21);
			this.dtPicker.TabIndex = 3;
			// 
			// Register
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.ClientSize = new System.Drawing.Size(600, 398);
			this.Controls.Add(this.dtPicker);
			this.Controls.Add(this.picOfReg);
			this.Controls.Add(this.txtPassword);
			this.Controls.Add(this.txtPosition);
			this.Controls.Add(this.txtName);
			this.Controls.Add(this.rb2);
			this.Controls.Add(this.rb1);
			this.MaximizeBox = false;
			this.Name = "Register";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "用户注册";
			this.Load += new System.EventHandler(this.Register_Load);
			this.Enter += new System.EventHandler(this.Register_Enter);
			this.ResumeLayout(false);

		}
		#endregion

		private void button1_Click(object sender, System.EventArgs e)
		{
			Admin adm = new Admin(txtName.Text ,rb1.Checked ? "男":"女",txtPassword.Text,txtPosition.Text, dtPicker.Value.ToShortDateString( ) );
			if(adm.Register( ))
			{
				MessageBox.Show("注册成功!","注册提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Information );
				this.DialogResult = DialogResult.OK;
				
			}
			else
			{
				MessageBox.Show("此注册名已经注册,请换个注册名!","注册提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Information );
				this.DialogResult = DialogResult.No;
			}
		}

		private void picOfReg_MouseHover(object sender, System.EventArgs e)
		{
			
		}
		
		private void picOfReg_MouseLeave(object sender, System.EventArgs e)
		{
		    picOfReg.Image = Image.FromFile( "img\\button-注册01.GIF");
			//picOfEdit.Image = Image.FromFile( "..\\..\\img\\用户信息管理1.GIF" );
		}
		
		private void picOfReg_MouseEnter(object sender, System.EventArgs e)
		{
            picOfReg.Image = Image.FromFile( "img\\button-注册03.GIF");
		}


		private void Register_Load(object sender, System.EventArgs e)
		{
		
		}

		private void picOfReg_Click(object sender, System.EventArgs e)
		{
			/////////////////////////////////////////////////
			txtName.Text = txtName.Text.Trim();
			txtPassword.Text = txtPassword.Text.Trim();
			txtPosition.Text = txtPosition.Text.Trim();
//			txtBirthday.Text = txtBirthday.Text.Trim();
//			if((txtName.Text.Length == 0)||(txtPassword.Text.Length == 0)||(txtPosition.Text.Length == 0)||(txtBirthday.Text.Length == 0)||(!(rb1.Checked||rb2.Checked)))
			if((txtName.Text.Length == 0)||(txtPassword.Text.Length == 0)||(txtPosition.Text.Length == 0)||(!(rb1.Checked||rb2.Checked)))
			{
				MessageBox.Show("请确认是否填写全部资料");
				txtPassword.Text = "";
				return;
			}

			/////////////////////////////////////////////////

			Admin adm = new Admin(txtName.Text ,rb1.Checked ? "男":"女",txtPassword.Text,txtPosition.Text, dtPicker.Value.ToLongDateString( ) );
			if(adm.Register( ))
			{
				MessageBox.Show("注册成功!","注册提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Information );
				this.DialogResult = DialogResult.OK;
				
			}
			else
			{
				MessageBox.Show("此注册名已经注册,请换个注册名!","注册提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Information );
				this.DialogResult = DialogResult.No;
			}
		}

		private void picOfReg_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
		{
		  picOfReg.Image = Image.FromFile( "img\\button-注册02.GIF");
		}

		private void picOfReg_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
		{
		  picOfReg.Image = Image.FromFile( "img\\button-注册03.GIF");
		}

		private void Register_Enter(object sender, System.EventArgs e)
		{
			txtName.Text = txtName.Text.Trim();
			txtPassword.Text = txtPassword.Text.Trim();
			txtPosition.Text = txtPosition.Text.Trim();
			if((txtName.Text.Length == 0)||(txtPassword.Text.Length == 0)||(txtPosition.Text.Length == 0)||(!(rb1.Checked||rb2.Checked)))
			{
				MessageBox.Show("请确认是否填写全部资料");
				txtPassword.Text = "";
				return;
			}

			/////////////////////////////////////////////////

			Admin adm = new Admin(txtName.Text ,rb1.Checked ? "男":"女",txtPassword.Text,txtPosition.Text, dtPicker.Value.ToShortDateString( ) );
			if(adm.Register( ))
			{
				MessageBox.Show("注册成功!","注册提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Information );
				this.DialogResult = DialogResult.OK;	
			}
			else
			{
				MessageBox.Show("注册失败!","注册提示窗口",MessageBoxButtons.OK,MessageBoxIcon.Information );
				this.DialogResult = DialogResult.No;
			}
		}
	}
}

⌨️ 快捷键说明

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