魔兽系统

//点击x按钮触发的事件
        private void btnclose_Click(object sender, EventArgs e)
        {
            //退出整个应用
            Application.Exit();
        }

        //点击注册按钮触发的事件
        private void lblregister_Click(object sender, EventArgs e)
        {
            //隐藏当前窗体
            this.Hide();
            FrmRegist frm = new FrmRegist();
            frm.fl = this;
            frm.Show();
        }


        //点击登录按钮触发的事件
        private void btnlogin_Click(object sender, EventArgs e)
        {
            if (ProvingInfo()==true)
          {
             //定义变量接收文本框中的值
              string email = txtemail.Text;
              string password = txtpassword.Text;
              bool happy = false;
              foreach (LoginInfo item in LoginInfo.array)
              {
                  if(item!=null)
                  {
                      if (item.Email.Equals(email) && item.Password.Equals(password))
                      {
                          happy = true;
                          //关闭当前窗体
                          this.Hide();
                          //显示主窗体
                          FrmMain frm = new FrmMain();
                          frm.loginame = item.Name;
                          frm.Show();
                          break;
                      }
                  
                  }
              }
                if(happy==false)
                {
                    MessageBox.Show("登录失败!请检查邮箱和密码是否正确"); 
                }
          }

        }
        //验证填写信息
        public bool ProvingInfo()
        { 
           if(txtemail.Text.Trim().Equals(string.Empty))
           {
           MessageBox.Show("请填写email");
               this.txtemail.Focus();
               return false;
           }
           else if (txtpassword.Text.Trim().Equals(string.Empty))
           {
               MessageBox.Show("请填写密码");
               this.txtpassword.Focus();
               return false;
           }
           else
           {

               return true;
           }
        
        }
        
        //Load事件
        private void FrmLogin_Load(object sender, EventArgs e)
        {

      
             LoginInfo info1 = new LoginInfo();
            info1.Name = "泪洒星辰";
            info1.Id = "123123131313131";
            info1.Email = "lsxc@163.com";
            info1.Password = "pwd@123";
            for (int i = 0; i < LoginInfo.array.Length; i++)
            {
                if (LoginInfo.array[i] == null)
                {
                    LoginInfo.array[i] = info1;
                    break;
                }
            }

    partial class FrmRegist
    {
        // Required designer variable.

        private System.ComponentModel.IContainer components = null;

        // Clean up any resources being used.
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        //Required method for Designer support - do not modify
        // the contents of this method with the code editor.
        private void InitializeComponent()
        {
            this.lblname = new System.Windows.Forms.Label();
            this.lblcid = new System.Windows.Forms.Label();
            this.lblemail = new System.Windows.Forms.Label();
            this.lblpassword = new System.Windows.Forms.Label();
            this.txtname = new System.Windows.Forms.TextBox();
            this.txtcid = new System.Windows.Forms.TextBox();
            this.txtemail = new System.Windows.Forms.TextBox();
            this.txtpassword = new System.Windows.Forms.TextBox();
            this.lblok = new System.Windows.Forms.Label();
            this.lblkoone = new System.Windows.Forms.Label();
            this.txtone = new System.Windows.Forms.TextBox();
            this.txtokone = new System.Windows.Forms.TextBox();
            this.label6 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.btnregin = new System.Windows.Forms.Button();
            this.btnclose = new System.Windows.Forms.Button();
            this.SuspendLayout(); 
            // lblname
            this.lblname.AutoSize = true;
            this.lblname.Font = new System.Drawing.Font("楷体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblname.Location = new System.Drawing.Point(88, 196);
            this.lblname.Name = "lblname";
            this.lblname.Size = new System.Drawing.Size(59, 19);
            this.lblname.TabIndex = 0;
            this.lblname.Text = "姓名:";
            // lblcid
            this.lblcid.AutoSize = true;
            this.lblcid.Font = new System.Drawing.Font("楷体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblcid.Location = new System.Drawing.Point(8, 231);
            this.lblcid.Name = "lblcid";
            this.lblcid.Size = new System.Drawing.Size(119, 19);
            this.lblcid.TabIndex = 0;
            this.lblcid.Text = "身份证号码:";
            // lblemail
            this.lblemail.AutoSize = true;
            this.lblemail.Font = new System.Drawing.Font("楷体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblemail.Location = new System.Drawing.Point(48, 274);
            this.lblemail.Name = "lblemail";
            this.lblemail.Size = new System.Drawing.Size(99, 19);
            this.lblemail.TabIndex = 0;
            this.lblemail.Text = "邮箱地址:";
            // 
            // lblpassword
            // 
            this.lblpassword.AutoSize = true;
            this.lblpassword.Font = new System.Drawing.Font("楷体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblpassword.Location = new System.Drawing.Point(88, 320);
            this.lblpassword.Name = "lblpassword";
            this.lblpassword.Size = new System.Drawing.Size(59, 19);
            this.lblpassword.TabIndex = 0;
            this.lblpassword.Text = "密码:";
            // 
            // txtname
            // 
            this.txtname.Location = new System.Drawing.Point(154, 193);
            this.txtname.Name = "txtname";
            this.txtname.Size = new System.Drawing.Size(190, 21);
            this.txtname.TabIndex = 1;
            // 
            // txtcid
            // 
            this.txtcid.Location = new System.Drawing.Point(153, 234);
            this.txtcid.Name = "txtcid";
            this.txtcid.Size = new System.Drawing.Size(190, 21);
            this.txtcid.TabIndex = 1;
            // 
            // txtemail
            // 
            this.txtemail.Location = new System.Drawing.Point(153, 277);
            this.txtemail.Name = "txtemail";
            this.txtemail.Size = new System.Drawing.Size(190, 21);
            this.txtemail.TabIndex = 1;
            this.txtemail.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
            // 
            // txtpassword
            // 
            this.txtpassword.Location = new System.Drawing.Point(153, 320);
            this.txtpassword.Name = "txtpassword";
            this.txtpassword.Size = new System.Drawing.Size(190, 21);
            this.txtpassword.TabIndex = 1;
            // 
            // lblok
            // 
            this.lblok.AutoSize = true;
            this.lblok.Font = new System.Drawing.Font("楷体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblok.Location = new System.Drawing.Point(366, 279);
            this.lblok.Name = "lblok";
            this.lblok.Size = new System.Drawing.Size(99, 19);
            this.lblok.TabIndex = 0;
            this.lblok.Text = "确认输入:";
            // 
            // lblkoone
            // 
            this.lblkoone.AutoSize = true;
            this.lblkoone.Font = new System.Drawing.Font("楷体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lblkoone.Location = new System.Drawing.Point(366, 320);
            this.lblkoone.Name = "lblkoone";
            this.lblkoone.Size = new System.Drawing.Size(99, 19);
            this.lblkoone.TabIndex = 0;
            this.lblkoone.Text = "确认输入:";
            // 
            // txtone
            // 
            this.txtone.Location = new System.Drawing.Point(471, 282);
            this.txtone.Name = "txtone";
            this.txtone.Size = new System.Drawing.Size(190, 21);
            this.txtone.TabIndex = 1;
            this.txtone.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
            // 
            // txtokone
            // 
            this.txtokone.Location = new System.Drawing.Point(471, 320);
            this.txtokone.Name = "txtokone";
            this.txtokone.Size = new System.Drawing.Size(190, 21);
            this.txtokone.TabIndex = 1;
            this.txtokone.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.Font = new System.Drawing.Font("楷体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label6.Location = new System.Drawing.Point(98, 377);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(99, 19);
            this.label6.TabIndex = 0;
            this.label6.Text = "适龄提示:";
            this.label6.Click += new System.EventHandler(this.label6_Click);
            // 
            // label7
            // 
            this.label7.AutoSize = true;
            this.label7.Font = new System.Drawing.Font("楷体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label7.ForeColor = System.Drawing.Color.Red;
            this.label7.Location = new System.Drawing.Point(216, 377);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(419, 19);
            this.label7.TabIndex = 0;
            this.label7.Text = "<<星际争霸:自由之翼TM>>适合12岁以上的玩家";
            // 
            // btnregin
            // 
            this.btnregin.BackColor = System.Drawing.Color.Black;
            this.btnregin.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
            this.btnregin.ForeColor = System.Drawing.Color.Transparent;
            this.btnregin.Location = new System.Drawing.Point(188, 432);
            this.btnregin.Name = "btnregin";
            this.btnregin.Size = new System.Drawing.Size(122, 42);
            this.btnregin.TabIndex = 2;
            this.btnregin.Text = "免费注册战网通行证";
            this.btnregin.UseVisualStyleBackColor = false;
            this.btnregin.Click += new System.EventHandler(this.btnregin_Click);
            // 
            // btnclose
            // 
            this.btnclose.BackColor = System.Drawing.Color.Black;
            this.btnclose.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
            this.btnclose.ForeColor = System.Drawing.Color.Transparent;
            this.btnclose.Location = new System.Drawing.Point(370, 432);
            this.btnclose.Name = "btnclose";
            this.btnclose.Size = new System.Drawing.Size(60, 42);
            this.btnclose.TabIndex = 2;
            this.btnclose.Text = "取消";
            this.btnclose.UseVisualStyleBackColor = false;
            this.btnclose.Click += new System.EventHandler(this.btnclose_Click);
            // 
            // FrmRegist
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackgroundImage = global::Game.Properties.Resources.魔兽注册图标;
            this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.ClientSize = new System.Drawing.Size(796, 486);
            this.Controls.Add(this.btnclose);
            this.Controls.Add(this.btnregin);
            this.Controls.Add(this.txtpassword);
            this.Controls.Add(this.txtokone);
            this.Controls.Add(this.txtone);
            this.Controls.Add(this.txtemail);
            this.Controls.Add(this.txtcid);
            this.Controls.Add(this.txtname);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.label7);
            this.Controls.Add(this.lblpassword);
            this.Controls.Add(this.lblkoone);
            this.Controls.Add(this.lblok);
            this.Controls.Add(this.lblemail);
            this.Controls.Add(this.lblcid);
            this.Controls.Add(this.lblname);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name = "FrmRegist";
            this.Text = "FrmRegist";
            this.Load += new System.EventHandler(this.FrmRegist_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label lblname;
        private System.Windows.Forms.Label lblcid;
        private System.Windows.Forms.Label lblemail;
        private System.Windows.Forms.Label lblpassword;
        private System.Windows.Forms.TextBox txtname;
        private System.Windows.Forms.TextBox txtcid;
        private System.Windows.Forms.TextBox txtemail;
        private System.Windows.Forms.TextBox txtpassword;
        private System.Windows.Forms.Label lblok;
        private System.Windows.Forms.Label lblkoone;
        private System.Windows.Forms.TextBox txtone;
        private System.Windows.Forms.TextBox txtokone;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Button btnregin;
        private System.Windows.Forms.Button btnclose;
    }

  

partial class FrmMain
    {
        // Required designer variable.
        private System.ComponentModel.IContainer components = null;

        // Clean up any resources being used.
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        // Required method for Designer support - do not modify
        // the contents of this method with the code editor.
        private void InitializeComponent()
        {
            this.SuspendLayout();
            // FrmMain
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackgroundImage = global::Game.Properties.Resources.魔兽世界首页;
            this.ClientSize = new System.Drawing.Size(993, 531);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Name = "FrmMain";
            this.Text = "FrmMain";
            this.Load += new System.EventHandler(this.FrmMain_Load);
            this.ResumeLayout(false);

        }

        #endregion

    }

  

posted @ 2017-03-10 10:38  易烊千鹿  阅读(529)  评论(1编辑  收藏  举报