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

📄 messageform.cs

📁 语音视频功能 里面实现了基本的QQ与语音对话
💻 CS
📖 第 1 页 / 共 2 页
字号:
//#define Test
using System;
using System.IO;
using System.Xml;
using System.Threading;
using System.Drawing;
using System.Windows.Forms;

using gowk.common;
using gowk.core.managers;
using gowk.core.packets;
using gowk.core.packets.querys;
using gowk.net.Sockets;
using gowk.core;
using gowk.net;
using gowk.controls;

namespace gowk.forms
{
	/// <summary>
	/// MessageForm 的摘要说明。
	/// </summary>
	public class MessageForm : GForm
	{
		#region field
		private System.Windows.Forms.Splitter splitter1;
		private gowk.controls.GPanel pnlRight;
		private gowk.controls.GPanel pnlTop;
		private gowk.controls.GPanel pnlFrame;
		private gowk.forms.GRichTextBoxEX gRichTextBoxEX1;
		private System.Windows.Forms.Splitter splitter2;
		private gowk.controls.GRichTextBox history;
		private System.ComponentModel.IContainer components;

		private JabberClient jc;
		private Item _itm;
		private Item itm
		{
			get{return _itm;}
			set
			{
				_itm=value;
			}
		}
		private gowk.controls.GButton gButton1;
		private AVForm avf;
		private gowk.controls.GImage gImage1;
		private gowk.controls.GButton gButton2;
		private gowk.controls.GButton gButton3;
		private gowk.controls.GImage gup;
		private gowk.controls.GImage gdown;
		private System.Windows.Forms.ToolTip toolTip1;
		MessageManager mm;
		#endregion

		public MessageForm(JabberClient jc,Item itm)
		{
			this.jc=jc;
			this.itm=itm;
#if !Test	
				mm=(MessageManager)this.jc.Managers[typeof(MessageManager)];

				mm.ChatMessageReceived+=new JabberEventHandler(mm_ChatMessageReceived);
				mm.ChatMessageError+=new JabberEventHandler(mm_ChatMessageError);
				mm.HeadLineMessageReceived+=new JabberEventHandler(mm_HeadLineMessageReceived);
			mm.VideoChatReceived+=new JabberEventHandler(mm_VideoChatReceived);
#endif
			InitializeComponent();
			this.InitializeSkin();
			this.InitializeTimers();
			
			this.gRichTextBoxEX1.Notify("请在这里输入消息");
			this.history.LinkClicked+=new LinkClickedEventHandler(history_LinkClicked);
		}
		private void InitializeSkin()
		{
			gowk.common.SkinConfig skf=gowk.common.SkinConfig.Instance;
			skf.SkinChanged+=new EventHandler(skf_SkinChanged);
			this.skf_SkinChanged(null,null);
		}


		private void skf_SkinChanged(object sender, EventArgs e)
		{
			gowk.common.SkinConfig skf=gowk.common.SkinConfig.Instance;
			this.ImageTopLeft=skf.GetImage("/gowk_skin/images/form/t1");
			this.ImageTopCenter=skf.GetImage("/gowk_skin/images/form/t2");
			this.ImageTopRight=skf.GetImage("/gowk_skin/images/form/t3");

			this.ImageMiddleLeft=skf.GetImage("/gowk_skin/images/form/m1");
			this.ImageMiddleCenter=skf.GetImage("/gowk_skin/images/form/m2");
			this.ImageMiddleRight=skf.GetImage("/gowk_skin/images/form/m3");

			this.ImageBottomLeft=skf.GetImage("/gowk_skin/images/form/b1");
			this.ImageBottomCenter=skf.GetImage("/gowk_skin/images/form/b2");
			this.ImageBottomRight=skf.GetImage("/gowk_skin/images/form/b3");
		}
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
#if !Test	
				mm.ChatMessageReceived-=new JabberEventHandler(mm_ChatMessageReceived);
				mm.ChatMessageError-=new JabberEventHandler(mm_ChatMessageError);
				mm.HeadLineMessageReceived-=new JabberEventHandler(mm_HeadLineMessageReceived);
				mm.VideoChatReceived-=new JabberEventHandler(mm_VideoChatReceived);
#endif
				if(this.avf!=null)
				{
					this.avf.Closed+=new EventHandler(avf_Closed);
					this.avf.Close();
				}
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
		public JabberClient JabberClient
		{
			get{return this.jc;}
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MessageForm));
			this.splitter1 = new System.Windows.Forms.Splitter();
			this.pnlRight = new gowk.controls.GPanel();
			this.pnlTop = new gowk.controls.GPanel();
			this.gButton1 = new gowk.controls.GButton();
			this.gImage1 = new gowk.controls.GImage();
			this.pnlFrame = new gowk.controls.GPanel();
			this.gButton3 = new gowk.controls.GButton();
			this.gdown = new gowk.controls.GImage();
			this.gButton2 = new gowk.controls.GButton();
			this.gup = new gowk.controls.GImage();
			this.history = new gowk.controls.GRichTextBox();
			this.splitter2 = new System.Windows.Forms.Splitter();
			this.gRichTextBoxEX1 = new gowk.forms.GRichTextBoxEX();
			this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
			this.pnlTop.SuspendLayout();
			this.pnlFrame.SuspendLayout();
			this.SuspendLayout();
			// 
			// splitter1
			// 
			this.splitter1.BackColor = System.Drawing.Color.White;
			this.splitter1.Dock = System.Windows.Forms.DockStyle.Right;
			this.splitter1.Location = new System.Drawing.Point(343, 32);
			this.splitter1.Name = "splitter1";
			this.splitter1.Size = new System.Drawing.Size(1, 248);
			this.splitter1.TabIndex = 2;
			this.splitter1.TabStop = false;
			// 
			// pnlRight
			// 
			this.pnlRight.BackColor = System.Drawing.Color.Transparent;
			this.pnlRight.Dock = System.Windows.Forms.DockStyle.Right;
			this.pnlRight.GBorderStyle = gowk.controls.GBorderStyle.Null;
			this.pnlRight.IsRound = false;
			this.pnlRight.Location = new System.Drawing.Point(344, 32);
			this.pnlRight.Name = "pnlRight";
			this.pnlRight.Size = new System.Drawing.Size(32, 248);
			this.pnlRight.TabIndex = 1;
			this.pnlRight.Visible = false;
			// 
			// pnlTop
			// 
			this.pnlTop.BackColor = System.Drawing.Color.Transparent;
			this.pnlTop.Controls.Add(this.gButton1);
			this.pnlTop.Dock = System.Windows.Forms.DockStyle.Top;
			this.pnlTop.GBorderStyle = gowk.controls.GBorderStyle.Solid;
			this.pnlTop.IsRound = false;
			this.pnlTop.Location = new System.Drawing.Point(0, 0);
			this.pnlTop.Name = "pnlTop";
			this.pnlTop.Size = new System.Drawing.Size(376, 32);
			this.pnlTop.TabIndex = 0;
			// 
			// gButton1
			// 
			this.gButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.gButton1.GBorderStyle = gowk.controls.GBorderStyle.Null;
			this.gButton1.GImage = this.gImage1;
			this.gButton1.IsRound = true;
			this.gButton1.Location = new System.Drawing.Point(336, 8);
			this.gButton1.Name = "gButton1";
			this.gButton1.Size = new System.Drawing.Size(24, 20);
			this.gButton1.TabIndex = 0;
			this.toolTip1.SetToolTip(this.gButton1, "视频聊天");
			this.gButton1.Click += new System.EventHandler(this.gButton1_Click);
			// 
			// gImage1
			// 
			this.gImage1.ActiveImage = ((System.Drawing.Image)(resources.GetObject("gImage1.ActiveImage")));
			this.gImage1.Image = ((System.Drawing.Image)(resources.GetObject("gImage1.Image")));
			this.gImage1.NormalImage = ((System.Drawing.Image)(resources.GetObject("gImage1.NormalImage")));
			this.gImage1.PressedImage = ((System.Drawing.Image)(resources.GetObject("gImage1.PressedImage")));
			// 
			// pnlFrame
			// 
			this.pnlFrame.BackColor = System.Drawing.Color.Transparent;
			this.pnlFrame.Controls.Add(this.gButton3);
			this.pnlFrame.Controls.Add(this.gButton2);
			this.pnlFrame.Controls.Add(this.history);
			this.pnlFrame.Controls.Add(this.splitter2);
			this.pnlFrame.Controls.Add(this.gRichTextBoxEX1);
			this.pnlFrame.Controls.Add(this.splitter1);
			this.pnlFrame.Controls.Add(this.pnlRight);
			this.pnlFrame.Controls.Add(this.pnlTop);
			this.pnlFrame.Dock = System.Windows.Forms.DockStyle.Fill;
			this.pnlFrame.GBorderStyle = gowk.controls.GBorderStyle.Null;
			this.pnlFrame.IsRound = true;
			this.pnlFrame.Location = new System.Drawing.Point(0, 0);
			this.pnlFrame.Name = "pnlFrame";
			this.pnlFrame.Size = new System.Drawing.Size(376, 280);
			this.pnlFrame.TabIndex = 0;
			// 
			// gButton3
			// 
			this.gButton3.GBorderStyle = gowk.controls.GBorderStyle.Solid;
			this.gButton3.GImage = this.gdown;
			this.gButton3.IsRound = true;
			this.gButton3.Location = new System.Drawing.Point(400, 56);
			this.gButton3.Name = "gButton3";
			this.gButton3.Size = new System.Drawing.Size(16, 16);
			this.gButton3.TabIndex = 9;
			this.gButton3.Click += new System.EventHandler(this.gButton3_Click);
			this.gButton3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.gButton3_MouseUp);
			this.gButton3.MouseDown += new System.Windows.Forms.MouseEventHandler(this.gButton3_MouseDown);
			// 
			// gdown
			// 
			this.gdown.ActiveImage = ((System.Drawing.Image)(resources.GetObject("gdown.ActiveImage")));
			this.gdown.Image = null;
			this.gdown.NormalImage = ((System.Drawing.Image)(resources.GetObject("gdown.NormalImage")));
			this.gdown.PressedImage = ((System.Drawing.Image)(resources.GetObject("gdown.PressedImage")));
			// 
			// gButton2
			// 
			this.gButton2.GBorderStyle = gowk.controls.GBorderStyle.Solid;
			this.gButton2.GImage = this.gup;
			this.gButton2.IsRound = true;
			this.gButton2.Location = new System.Drawing.Point(400, 40);
			this.gButton2.Name = "gButton2";
			this.gButton2.Size = new System.Drawing.Size(16, 16);
			this.gButton2.TabIndex = 8;
			this.gButton2.Click += new System.EventHandler(this.gButton2_Click);
			this.gButton2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.gButton2_MouseUp);
			this.gButton2.MouseDown += new System.Windows.Forms.MouseEventHandler(this.gButton2_MouseDown);
			// 
			// gup
			// 
			this.gup.ActiveImage = ((System.Drawing.Image)(resources.GetObject("gup.ActiveImage")));
			this.gup.Image = null;
			this.gup.NormalImage = ((System.Drawing.Image)(resources.GetObject("gup.NormalImage")));
			this.gup.PressedImage = ((System.Drawing.Image)(resources.GetObject("gup.PressedImage")));
			// 
			// history
			// 
			this.history.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.history.Dock = System.Windows.Forms.DockStyle.Fill;
			this.history.HideSelection = false;
			this.history.HiglightColor = Khendys.Controls.RtfColor.White;
			this.history.Location = new System.Drawing.Point(0, 32);
			this.history.Name = "history";
			this.history.ReadOnly = true;
			this.history.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
			this.history.Size = new System.Drawing.Size(343, 175);
			this.history.TabIndex = 7;
			this.history.Text = "";
			this.history.TextColor = Khendys.Controls.RtfColor.Black;
			// 
			// splitter2
			// 
			this.splitter2.BackColor = System.Drawing.Color.White;
			this.splitter2.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.splitter2.Location = new System.Drawing.Point(0, 207);
			this.splitter2.Name = "splitter2";
			this.splitter2.Size = new System.Drawing.Size(343, 1);
			this.splitter2.TabIndex = 6;
			this.splitter2.TabStop = false;
			// 
			// gRichTextBoxEX1
			// 
			this.gRichTextBoxEX1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(76)), ((System.Byte)(230)), ((System.Byte)(230)), ((System.Byte)(230)));
			this.gRichTextBoxEX1.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.gRichTextBoxEX1.GBorderStyle = gowk.controls.GBorderStyle.Solid;
			this.gRichTextBoxEX1.IsRound = true;
			this.gRichTextBoxEX1.Location = new System.Drawing.Point(0, 208);
			this.gRichTextBoxEX1.Name = "gRichTextBoxEX1";
			this.gRichTextBoxEX1.Size = new System.Drawing.Size(343, 72);
			this.gRichTextBoxEX1.TabIndex = 5;
			this.gRichTextBoxEX1.SendMessage += new gowk.forms.GRichTextBoxEX.SendMessageEventHandler(this.gRichTextBoxEX1_SendMessage);
			// 
			// MessageForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackColor = System.Drawing.Color.Gray;
			this.ClientSize = new System.Drawing.Size(376, 280);
			this.Controls.Add(this.pnlFrame);
			this.Name = "MessageForm";
			this.Text = "MessageForm";
			this.TransparencyKey = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(128)));
			this.pnlTop.ResumeLayout(false);
			this.pnlFrame.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void gRichTextBoxEX1_SendMessage(object sender, gowk.forms.GRichTextBoxEX.SendMessageEventArgs se)
		{
			this.history.Select(this.history.Text.Length,0);
			Color c=this.history.SelectionColor;
			//	Font f=this.history.SelectionFont;
			this.history.SelectionColor=Color.Blue;

⌨️ 快捷键说明

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