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

📄 mainform.cs

📁 语音视频功能 里面实现了基本的QQ与语音对话
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using gowk.utility.Controls;
using gowk.utility.common;
namespace gowk
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class MainForm :GForm
	{
		private gowk.utility.Controls.GTabControl gTabControl1;
		private GListView _GListView;
	private GTabPage tpChat;
		GListViewFolder gowkFriend;
		GListViewFolder gowkGroup;
		private System.Windows.Forms.NotifyIcon notifyIcon1;
		private System.ComponentModel.IContainer components;
		private gowk.utility.Controls.GContextMenu gContextMenu1;
		private gowk.utility.Controls.GButton gButton1;
		private gowk.utility.Controls.GButton gButton2;
		private gowk.utility.Controls.GButton gButton6;
		private gowk.utility.Controls.GButton btnClose;
		private gowk.utility.Controls.GButton btnMinimize;
		private gowk.utility.Controls.GButton btnSkin;
		GListViewFolder gowkRecent;
		public MainForm()
		{
			InitializeComponent();
			this.TopMost=true;

			this.gTabControl1.ItemSize=new Size(32,32);
			this.gTabControl1.Alignment=GAlignment.Left;

			tpChat=new GTabPage();
			tpChat.GImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\skin\chat.jpg");
			this.gTabControl1.GTabPages.Add(tpChat);
			
			GTabPage tpMobile=new GTabPage();
			tpMobile.GImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\skin\mobilephone.jpg");
			this.gTabControl1.GTabPages.Add(tpMobile);

			GTabPage tpEmail=new GTabPage();
			tpEmail.GImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\skin\mobilephone.jpg");
			this.gTabControl1.GTabPages.Add(tpEmail);

			GTabPage tpGame=new GTabPage();
			tpGame.GImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\skin\mobilephone.jpg");
			this.gTabControl1.GTabPages.Add(tpGame);

			GTabPage tpRoom=new GTabPage();
			tpRoom.GImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\skin\mobilephone.jpg");
			this.gTabControl1.GTabPages.Add(tpRoom);

			GTabPage tpForum=new GTabPage();
			tpForum.GImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\skin\mobilephone.jpg");
			this.gTabControl1.GTabPages.Add(tpForum);

			GTabPage tpBlog=new GTabPage();
			tpBlog.GImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\skin\mobilephone.jpg");
			this.gTabControl1.GTabPages.Add(tpBlog);

			GTabPage tpMyHDD=new GTabPage();
			tpMyHDD.GImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\skin\mobilephone.jpg");
			this.gTabControl1.GTabPages.Add(tpMyHDD);
			
			GTabPage tpMyFavorite=new GTabPage();
			tpMyFavorite.GImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\skin\mobilephone.jpg");
			this.gTabControl1.GTabPages.Add(tpMyFavorite);


			//GlistView
			this._GListView=new GListView();
			this._GListView.Dock=DockStyle.Fill;
			this._GListView.DrawItem+=new gowk.utility.Controls.DrawItemEventHandler(_GListView_DrawItem);
			this.tpChat.Controls.Add(this._GListView);

			gowkFriend=new GListViewFolder();
			gowkFriend.Text="gowk好友";
			gowkFriend.BackGroundImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\button3.bmp");
		//	gowkFriend.View=View.SmallIcon;
			this._GListView.Items.Add(gowkFriend);

			for(int i=0;i<5;i++)
			{
				GListViewItem itm=new GListViewItem();
				this.gowkFriend.Items.Add(itm);
				itm.Text="gowhcy";
				itm.GImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\face\001.gif");
			}

			this.gowkGroup=new GListViewFolder();
			this._GListView.Items.Add(gowkGroup);
			this.gowkGroup.Text="gowk群";
			this.gowkGroup.BackGroundImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\button3.bmp");

			this.gowkRecent=new GListViewFolder();
			this.gowkRecent.Text="最近联系人";
			this._GListView.Items.Add(gowkRecent);
			this.gowkRecent.BackGroundImage.Image=Image.FromFile(@"C:\Documents and Settings\Administrator\桌面\新建文件夹\button3.bmp");



			
			//GContextMenu
			GMenuItem skinMenuItem=new GMenuItem();
			skinMenuItem.Text="皮肤";
			

			Image img=Image.FromFile(@"C:\Documents and Settings\All Users\Documents\My Pictures\示例图片\Blue hills.jpg");
			for(int i=0;i<8;i++)
			{
				gowk.utility.Controls.GMenuItem itm=new gowk.utility.Controls.GMenuItem();
				itm.Text="彩旦:"+i.ToString();
				itm.Image=img;
				this.GContextMenu.MenuItems.Add(itm);
				if(i==5)
				{
					//	itm.Text="-";
				}
				if(i%3==0)
				{
					for(int j=0;j<8;j++)
					{
						gowk.utility.Controls.GMenuItem ij=new gowk.utility.Controls.GMenuItem();
						ij.Text=itm.Text+" "+j.ToString();
						ij.Image=img;
						itm.MenuItems.Add(ij);
					}
				}
			}

			this.GContextMenu.MenuItems.AddRange(new MenuItem[]{skinMenuItem});

			//this.gButton1
			this.gButton1.GImage.Image=new Bitmap(this.GetType(),"ANGEL.ICO");
			this.gButton1.GBorderStyle=GBorderStyle.Null;
			
		}
		public GContextMenu GContextMenu
		{
			get{return this.gContextMenu1;}
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
			this.gTabControl1 = new gowk.utility.Controls.GTabControl();
			this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
			this.gContextMenu1 = new gowk.utility.Controls.GContextMenu();
			this.gButton1 = new gowk.utility.Controls.GButton();
			this.gButton2 = new gowk.utility.Controls.GButton();
			this.btnClose = new gowk.utility.Controls.GButton();
			this.btnMinimize = new gowk.utility.Controls.GButton();
			this.btnSkin = new gowk.utility.Controls.GButton();
			this.gButton6 = new gowk.utility.Controls.GButton();
			this.gButton2.SuspendLayout();
			this.SuspendLayout();
			// 
			// gTabControl1
			// 
			this.gTabControl1.Alignment = gowk.utility.Controls.GAlignment.Left;
			this.gTabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.gTabControl1.BackColor = System.Drawing.Color.Transparent;
			this.gTabControl1.BorderColor = System.Drawing.Color.Gold;
			this.gTabControl1.GBorderStyle = gowk.utility.Controls.GBorderStyle.Solid;
			this.gTabControl1.IsRound = true;
			this.gTabControl1.ItemSize = new System.Drawing.Size(24, 28);
			this.gTabControl1.Location = new System.Drawing.Point(0, 56);
			this.gTabControl1.Name = "gTabControl1";
			this.gTabControl1.SelectedIndex = 0;
			
			this.gTabControl1.Size = new System.Drawing.Size(154, 290);
			this.gTabControl1.TabIndex = 2;
			// 
			// notifyIcon1
			// 
			this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
			this.notifyIcon1.Text = "notifyIcon1";
			this.notifyIcon1.Visible = true;
			this.notifyIcon1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseUp);
			// 
			// gContextMenu1
			// 
			this.gContextMenu1.Image = null;
			// 
			// gButton1
			// 
			this.gButton1.BorderColor = System.Drawing.Color.Gold;
			this.gButton1.GBorderStyle = gowk.utility.Controls.GBorderStyle.Solid;
			this.gButton1.IsRound = false;
			this.gButton1.Location = new System.Drawing.Point(16, 16);
			this.gButton1.Name = "gButton1";
			this.gButton1.Size = new System.Drawing.Size(40, 32);
			this.gButton1.TabIndex = 3;
			this.gButton1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.gButton1_MouseUp);
			// 
			// gButton2
			// 
			this.gButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.gButton2.BorderColor = System.Drawing.Color.Gold;
			this.gButton2.Controls.Add(this.btnClose);
			this.gButton2.Controls.Add(this.btnMinimize);
			this.gButton2.Controls.Add(this.btnSkin);
			this.gButton2.GBorderStyle = gowk.utility.Controls.GBorderStyle.Solid;
			this.gButton2.IsRound = true;
			this.gButton2.Location = new System.Drawing.Point(81, 5);
			this.gButton2.Name = "gButton2";
			this.gButton2.Size = new System.Drawing.Size(71, 24);
			this.gButton2.TabIndex = 4;
			// 
			// btnClose
			// 
			this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.btnClose.BorderColor = System.Drawing.Color.Gold;
			this.btnClose.GBorderStyle = gowk.utility.Controls.GBorderStyle.Solid;
			this.btnClose.IsRound = true;
			this.btnClose.Location = new System.Drawing.Point(46, 2);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new System.Drawing.Size(20, 20);
			this.btnClose.TabIndex = 9;
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// btnMinimize
			// 
			this.btnMinimize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.btnMinimize.BorderColor = System.Drawing.Color.Gold;
			this.btnMinimize.GBorderStyle = gowk.utility.Controls.GBorderStyle.Solid;
			this.btnMinimize.IsRound = true;
			this.btnMinimize.Location = new System.Drawing.Point(26, 2);
			this.btnMinimize.Name = "btnMinimize";
			this.btnMinimize.Size = new System.Drawing.Size(20, 20);
			this.btnMinimize.TabIndex = 8;
			this.btnMinimize.Click += new System.EventHandler(this.btnMinimize_Click);
			// 
			// btnSkin
			// 
			this.btnSkin.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.btnSkin.BorderColor = System.Drawing.Color.Gold;
			this.btnSkin.GBorderStyle = gowk.utility.Controls.GBorderStyle.Solid;
			this.btnSkin.IsRound = true;
			this.btnSkin.Location = new System.Drawing.Point(6, 2);
			this.btnSkin.Name = "btnSkin";
			this.btnSkin.Size = new System.Drawing.Size(20, 20);
			this.btnSkin.TabIndex = 7;
			// 
			// gButton6
			// 
			this.gButton6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
			this.gButton6.BorderColor = System.Drawing.Color.Gold;
			this.gButton6.GBorderStyle = gowk.utility.Controls.GBorderStyle.Solid;
			this.gButton6.IsRound = true;
			this.gButton6.Location = new System.Drawing.Point(26, 358);
			this.gButton6.Name = "gButton6";
			this.gButton6.Size = new System.Drawing.Size(104, 24);
			this.gButton6.TabIndex = 6;
			this.gButton6.Text = "bloser@gmail.com";
			// 
			// MainForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackColor = System.Drawing.Color.White;
			this.ClientSize = new System.Drawing.Size(154, 394);
			this.Controls.Add(this.gButton6);
			this.Controls.Add(this.gButton2);
			this.Controls.Add(this.gButton1);
			this.Controls.Add(this.gTabControl1);
			this.ImageBottomCenter = ((System.Drawing.Image)(resources.GetObject("$this.ImageBottomCenter")));
			this.ImageBottomLeft = ((System.Drawing.Image)(resources.GetObject("$this.ImageBottomLeft")));
			this.ImageBottomRight = ((System.Drawing.Image)(resources.GetObject("$this.ImageBottomRight")));
			this.ImageMiddleCenter = ((System.Drawing.Image)(resources.GetObject("$this.ImageMiddleCenter")));
			this.ImageMiddleLeft = ((System.Drawing.Image)(resources.GetObject("$this.ImageMiddleLeft")));
			this.ImageMiddleRight = ((System.Drawing.Image)(resources.GetObject("$this.ImageMiddleRight")));
			this.ImageTopCenter = ((System.Drawing.Image)(resources.GetObject("$this.ImageTopCenter")));
			this.ImageTopLeft = ((System.Drawing.Image)(resources.GetObject("$this.ImageTopLeft")));
			this.ImageTopRight = ((System.Drawing.Image)(resources.GetObject("$this.ImageTopRight")));
			this.IsRound = true;
			this.Name = "MainForm";
			this.StretchOption = gowk.utility.Controls.StretchOption.Scaled;
			this.Text = "Form1";
			this.TransparencyKey = System.Drawing.Color.Fuchsia;
			this.gButton2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void button1_Click(object sender, System.EventArgs e)
		{
			API.SendMessage(this.gTabControl1.Handle,0x1329,0,Util.MAKELPARAM(32,32));
		}

		protected override void Dispose(bool disposing)
		{
			if(disposing)
			{
				this.notifyIcon1.Dispose();
				this.notifyIcon1=null;
			}
			base.Dispose (disposing);
		}

		private void _GListView_DrawItem(object sender, GListViewDrawItemEventArgs e)
		{
			e.Drawed=false;
		}

		private void gButton1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			this.GContextMenu.Show(((Control)sender),new Point(e.X,e.Y));
		}

		private void notifyIcon1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			this.Activate();
			if(e.Button==MouseButtons.Left)
			{
			}
			else
			{
				this.GContextMenu.Show(this,this.PointToClient(Control.MousePosition));
			}
		}

		private void btnClose_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void btnMinimize_Click(object sender, System.EventArgs e)
		{
			this.WindowState=FormWindowState.Minimized;
		}

	}
}

⌨️ 快捷键说明

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