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

📄 loginpanel.cs

📁 语音视频功能 里面实现了基本的QQ与语音对话
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using gowk.core;
using gowk.core.managers;

namespace gowk.forms
{
	/// <summary>
	/// LoginPanel 的摘要说明。
	/// </summary>
	public class LoginPanel : System.Windows.Forms.UserControl
	{
		/// <summary> 
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.Label label2;
		private gowk.controls.GPanel login1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.LinkLabel linkGetPass;
		private System.Windows.Forms.LinkLabel linkReg;
		private gowk.controls.GButton btnLogin;
		private gowk.controls.GTextBox txtPass;
		private gowk.controls.GComboBox cmbUser;
		private gowk.controls.GButton gButton1;
		private gowk.controls.GPanel pnlProgress;
		private System.Windows.Forms.PictureBox progressBar;

		public event System.EventHandler OK;
		public event System.EventHandler CancelLogin;
		public LoginPanel()
		{
			InitializeComponent();

			this.SetStyle(ControlStyles.SupportsTransparentBackColor,true);
			this.ShowLogin();
			this.login1.Dock=DockStyle.Fill;
			this.pnlProgress.Dock=DockStyle.Fill;

			this.cmbUser.Text="gowhcy@jabber.org";
			this.txtPass.Text="waxmgp541";
			this.gButton1.Text="取消";
		}

		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
		public void ShowLogin()
		{
			this.login1.Visible=true;
			this.pnlProgress.Visible=false;
		}
		public void ShowProgress()
		{
			this.login1.Visible=false;
			this.pnlProgress.Visible=true;
		}

		#region 组件设计器生成的代码
		/// <summary> 
		/// 设计器支持所需的方法 - 不要使用代码编辑器 
		/// 修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(LoginPanel));
			this.label2 = new System.Windows.Forms.Label();
			this.login1 = new gowk.controls.GPanel();
			this.txtPass = new gowk.controls.GTextBox();
			this.cmbUser = new gowk.controls.GComboBox();
			this.label1 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.linkGetPass = new System.Windows.Forms.LinkLabel();
			this.linkReg = new System.Windows.Forms.LinkLabel();
			this.btnLogin = new gowk.controls.GButton();
			this.progressBar = new System.Windows.Forms.PictureBox();
			this.pnlProgress = new gowk.controls.GPanel();
			this.gButton1 = new gowk.controls.GButton();
			this.login1.SuspendLayout();
			this.pnlProgress.SuspendLayout();
			this.SuspendLayout();
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(0, 0);
			this.label2.Name = "label2";
			this.label2.TabIndex = 0;
			// 
			// login1
			// 
			this.login1.Controls.Add(this.txtPass);
			this.login1.Controls.Add(this.cmbUser);
			this.login1.Controls.Add(this.label1);
			this.login1.Controls.Add(this.label3);
			this.login1.Controls.Add(this.linkGetPass);
			this.login1.Controls.Add(this.linkReg);
			this.login1.Controls.Add(this.btnLogin);
			this.login1.GBorderStyle = gowk.controls.GBorderStyle.Null;
			this.login1.IsRound = true;
			this.login1.Location = new System.Drawing.Point(16, 32);
			this.login1.Name = "login1";
			this.login1.Size = new System.Drawing.Size(152, 136);
			this.login1.TabIndex = 18;
			// 
			// txtPass
			// 
			this.txtPass.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.txtPass.BackColor = System.Drawing.SystemColors.Window;
			this.txtPass.DockPadding.All = 3;
			this.txtPass.GBorderStyle = gowk.controls.GBorderStyle.Solid;
			this.txtPass.IsRound = true;
			this.txtPass.Location = new System.Drawing.Point(44, 51);
			this.txtPass.Name = "txtPass";
			this.txtPass.PasswordChar = '\0';
			this.txtPass.Size = new System.Drawing.Size(100, 24);
			this.txtPass.TabIndex = 12;
			// 
			// cmbUser
			// 
			this.cmbUser.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.cmbUser.BackColor = System.Drawing.SystemColors.Window;
			this.cmbUser.DockPadding.All = 3;
			this.cmbUser.GBorderStyle = gowk.controls.GBorderStyle.Solid;
			this.cmbUser.IsRound = true;
			this.cmbUser.Location = new System.Drawing.Point(44, 22);
			this.cmbUser.MaxDropDownItems = 5;
			this.cmbUser.Name = "cmbUser";
			this.cmbUser.SelectedIndex = -1;
			this.cmbUser.SelectedItem = null;
			this.cmbUser.Size = new System.Drawing.Size(100, 24);
			this.cmbUser.TabIndex = 11;
			// 
			// label1
			// 
			this.label1.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.label1.Location = new System.Drawing.Point(4, 56);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(48, 14);
			this.label1.TabIndex = 17;
			this.label1.Text = "密码";
			// 
			// label3
			// 
			this.label3.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.label3.Location = new System.Drawing.Point(4, 31);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(48, 23);
			this.label3.TabIndex = 16;
			this.label3.Text = "用户名";
			// 
			// linkGetPass
			// 
			this.linkGetPass.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.linkGetPass.Location = new System.Drawing.Point(84, 91);
			this.linkGetPass.Name = "linkGetPass";
			this.linkGetPass.Size = new System.Drawing.Size(56, 23);
			this.linkGetPass.TabIndex = 15;
			this.linkGetPass.TabStop = true;
			this.linkGetPass.Text = "忘记密码";
			// 
			// linkReg
			// 
			this.linkReg.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.linkReg.Location = new System.Drawing.Point(52, 91);
			this.linkReg.Name = "linkReg";
			this.linkReg.Size = new System.Drawing.Size(32, 23);
			this.linkReg.TabIndex = 14;
			this.linkReg.TabStop = true;
			this.linkReg.Text = "注册";
			this.linkReg.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkReg_LinkClicked);
			// 
			// btnLogin
			// 
			this.btnLogin.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.btnLogin.GBorderStyle = gowk.controls.GBorderStyle.Solid;
			this.btnLogin.IsRound = true;
			this.btnLogin.Location = new System.Drawing.Point(12, 83);
			this.btnLogin.Name = "btnLogin";
			this.btnLogin.Size = new System.Drawing.Size(24, 24);
			this.btnLogin.TabIndex = 13;
			this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
			// 
			// progressBar
			// 
			this.progressBar.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.progressBar.BackColor = System.Drawing.Color.Transparent;
			this.progressBar.Image = ((System.Drawing.Image)(resources.GetObject("progressBar.Image")));
			this.progressBar.Location = new System.Drawing.Point(32, 40);
			this.progressBar.Name = "progressBar";
			this.progressBar.Size = new System.Drawing.Size(104, 16);
			this.progressBar.TabIndex = 22;
			this.progressBar.TabStop = false;
			// 
			// pnlProgress
			// 
			this.pnlProgress.BackColor = System.Drawing.Color.Transparent;
			this.pnlProgress.Controls.Add(this.gButton1);
			this.pnlProgress.Controls.Add(this.progressBar);
			this.pnlProgress.GBorderStyle = gowk.controls.GBorderStyle.Solid;
			this.pnlProgress.IsRound = true;
			this.pnlProgress.Location = new System.Drawing.Point(400, 72);
			this.pnlProgress.Name = "pnlProgress";
			this.pnlProgress.Size = new System.Drawing.Size(168, 100);
			this.pnlProgress.TabIndex = 23;
			// 
			// gButton1
			// 
			this.gButton1.Anchor = System.Windows.Forms.AnchorStyles.None;
			this.gButton1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(128)), ((System.Byte)(0)));
			this.gButton1.GBorderStyle = gowk.controls.GBorderStyle.DashDotDot;
			this.gButton1.IsRound = true;
			this.gButton1.Location = new System.Drawing.Point(48, 56);
			this.gButton1.Name = "gButton1";
			this.gButton1.Size = new System.Drawing.Size(64, 20);
			this.gButton1.TabIndex = 23;
			this.gButton1.Click += new System.EventHandler(this.gButton1_Click);
			// 
			// LoginPanel
			// 
			this.BackColor = System.Drawing.SystemColors.Control;
			this.Controls.Add(this.pnlProgress);
			this.Controls.Add(this.login1);
			this.Name = "LoginPanel";
			this.Size = new System.Drawing.Size(632, 328);
			this.login1.ResumeLayout(false);
			this.pnlProgress.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void lblLogin_Click(object sender, System.EventArgs e)
		{
			this.ShowLogin();
		}

		private void btnLogin_Click(object sender, System.EventArgs e)
		{
			if(this.OK!=null)this.OK(this,e);
		}

		private void linkReg_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
		{
			RegistForm rf=new RegistForm();
			rf.ShowDialog(this);
			if(rf.DialogResult==DialogResult.OK)
			{
				this.txtPass.Text=rf.Pass;
				this.cmbUser.Items.Add(rf.User);
				this.cmbUser.Text=rf.User;
			}
			rf.Dispose();
		}

		private void gButton1_Click(object sender, System.EventArgs e)
		{
			if(CancelLogin!=null)this.CancelLogin(this,e);
		}
	
		public string User
		{
			get{return this.cmbUser.Text;}
			set{this.cmbUser.Text=value;}
		}
		public string Pass
		{
			get{return this.txtPass.Text;}
			set{this.txtPass.Text=value;}
		}
	}
}

⌨️ 快捷键说明

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