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

📄 myav.cs

📁 即时通讯系统LanMsg
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using LanMsg.AV;
using System.Net;

namespace LanMsg
{
	/// <summary>
	/// MyAV 的摘要说明。
	/// </summary>
	public class MyAV : System.Windows.Forms.UserControl
	{
		private System.ComponentModel.IContainer components;

		private LanMsg.AV.AV av;
		private Mixer mixer;
		private Mixer.MixerControlDetail indtl,outdtl;
		private System.Windows.Forms.TrackBar trackBarOut;
		private System.Windows.Forms.TrackBar trackBarIn;
        
		public System.Net.IPAddress serverIp;//对方的公网IP
		public int  serverPort;//对方的公网UDP端口
		private DevComponents.DotNetBar.Bar bar4;
		private DevComponents.DotNetBar.ButtonItem buttonItemNotice;
		private DevComponents.DotNetBar.LabelItem labelItem1;
		private System.Windows.Forms.Panel panel1;
		private System.Windows.Forms.Panel panelSelfAV;
		private System.Windows.Forms.PictureBox pictureBox2;
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.LinkLabel linkLabelCancelAV;
		public System.Windows.Forms.LinkLabel linkLabelReceve;
		public System.Windows.Forms.Timer timer1;//对方的公网端口
        public LanMsg.Controls.ClassMsg msg;
		private System.Windows.Forms.PictureBox picLocal;
		private System.Windows.Forms.PictureBox picRemoteBack;
		private System.Windows.Forms.PictureBox picRemote;//发送请求的消息
        public int colorChange=0;

		#region  AV传输事件
	
		public delegate void AVReceveEventHandler(object sender,bool isSelf);//接收AV对话事件
		public  event AVReceveEventHandler AVReceve; 

		public delegate void AVCancelEventHandler(object sender,bool isSelf);//取消AV对话事件
		public  event AVCancelEventHandler AVCancel; 
	    
		#endregion

		public MyAV()
		{
			// 该调用是 Windows.Forms 窗体设计器所必需的。
			InitializeComponent();
			InitializeMixing();
			 
			// TODO: 在 InitializeComponent 调用后添加任何初始化
		}

		private void InitializeMixing()//初始化声卡麦克风
		{
			mixer=new Mixer(this);
			mixer.MixerControlChange +=new EventHandler(mixer_MixerControlChange); 
			
			this.outdtl=new Mixer.MixerControlDetail(mixer,Mixer.MIXERLINE_COMPONENTTYPE_DST_SPEAKERS);
			this.trackBarOut.Minimum=this.outdtl.Min;
			this.trackBarOut.Maximum=this.outdtl.Max;
			this.trackBarOut.Value=this.outdtl.Volume;
			
			this.indtl=new Mixer.MixerControlDetail(mixer,Mixer.MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE);
			this.trackBarIn.Minimum=indtl.Min;
			this.trackBarIn.Maximum=indtl.Max;
			this.trackBarIn.Value=this.indtl.Volume;
		}

		/// <summary> 
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				mixer.MixerControlChange -=new EventHandler(mixer_MixerControlChange);
				try
				{
					this.av.AVChanel.Close();
				}
				catch{}
				try
				{
					this.av.Chanel.Close();
				}
				catch{}
				try
				{
					this.av.Dispose();
				}
				catch{}

				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region 组件设计器生成的代码
		/// <summary> 
		/// 设计器支持所需的方法 - 不要使用代码编辑器 
		/// 修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MyAV));
			this.trackBarIn = new System.Windows.Forms.TrackBar();
			this.trackBarOut = new System.Windows.Forms.TrackBar();
			this.bar4 = new DevComponents.DotNetBar.Bar();
			this.buttonItemNotice = new DevComponents.DotNetBar.ButtonItem();
			this.labelItem1 = new DevComponents.DotNetBar.LabelItem();
			this.panel1 = new System.Windows.Forms.Panel();
			this.picRemote = new System.Windows.Forms.PictureBox();
			this.picRemoteBack = new System.Windows.Forms.PictureBox();
			this.pictureBox2 = new System.Windows.Forms.PictureBox();
			this.panelSelfAV = new System.Windows.Forms.Panel();
			this.picLocal = new System.Windows.Forms.PictureBox();
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.linkLabelReceve = new System.Windows.Forms.LinkLabel();
			this.linkLabelCancelAV = new System.Windows.Forms.LinkLabel();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.timer1 = new System.Windows.Forms.Timer(this.components);
			((System.ComponentModel.ISupportInitialize)(this.trackBarIn)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.trackBarOut)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.bar4)).BeginInit();
			this.panel1.SuspendLayout();
			this.panelSelfAV.SuspendLayout();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// trackBarIn
			// 
			this.trackBarIn.Location = new System.Drawing.Point(56, 52);
			this.trackBarIn.Name = "trackBarIn";
			this.trackBarIn.Size = new System.Drawing.Size(56, 42);
			this.trackBarIn.TabIndex = 2;
			this.trackBarIn.Scroll += new System.EventHandler(this.trackBarOut_Scroll);
			// 
			// trackBarOut
			// 
			this.trackBarOut.Location = new System.Drawing.Point(56, 12);
			this.trackBarOut.Name = "trackBarOut";
			this.trackBarOut.Size = new System.Drawing.Size(56, 42);
			this.trackBarOut.TabIndex = 3;
			this.trackBarOut.Scroll += new System.EventHandler(this.trackBarOut_Scroll);
			// 
			// bar4
			// 
			this.bar4.Dock = System.Windows.Forms.DockStyle.Top;
			this.bar4.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
																				this.buttonItemNotice,
																				this.labelItem1});
			this.bar4.Location = new System.Drawing.Point(0, 0);
			this.bar4.Name = "bar4";
			this.bar4.Size = new System.Drawing.Size(296, 25);
			this.bar4.Stretch = true;
			this.bar4.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
			this.bar4.TabIndex = 42;
			this.bar4.TabStop = false;
			this.bar4.Text = "bar4";
			// 
			// buttonItemNotice
			// 
			this.buttonItemNotice.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItemNotice.Icon")));
			this.buttonItemNotice.Name = "buttonItemNotice";
			// 
			// labelItem1
			// 
			this.labelItem1.BorderType = DevComponents.DotNetBar.eBorderType.None;
			this.labelItem1.Name = "labelItem1";
			this.labelItem1.Text = "对方视频";
			// 
			// panel1
			// 
			this.panel1.BackColor = System.Drawing.Color.Cyan;
			this.panel1.Controls.Add(this.picRemote);
			this.panel1.Controls.Add(this.picRemoteBack);
			this.panel1.Controls.Add(this.pictureBox2);
			this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
			this.panel1.Location = new System.Drawing.Point(0, 25);
			this.panel1.Name = "panel1";
			this.panel1.Size = new System.Drawing.Size(296, 223);
			this.panel1.TabIndex = 43;
			// 
			// picRemote
			// 
			this.picRemote.BackColor = System.Drawing.Color.WhiteSmoke;
			this.picRemote.Location = new System.Drawing.Point(68, 51);
			this.picRemote.Name = "picRemote";
			this.picRemote.Size = new System.Drawing.Size(160, 120);
			this.picRemote.TabIndex = 10;
			this.picRemote.TabStop = false;
			// 
			// picRemoteBack
			// 
			this.picRemoteBack.BackColor = System.Drawing.Color.WhiteSmoke;
			this.picRemoteBack.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.picRemoteBack.Location = new System.Drawing.Point(8, 8);
			this.picRemoteBack.Name = "picRemoteBack";
			this.picRemoteBack.Size = new System.Drawing.Size(280, 208);
			this.picRemoteBack.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
			this.picRemoteBack.TabIndex = 8;
			this.picRemoteBack.TabStop = false;
			// 
			// pictureBox2
			// 
			this.pictureBox2.Dock = System.Windows.Forms.DockStyle.Fill;
			this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
			this.pictureBox2.Location = new System.Drawing.Point(0, 0);
			this.pictureBox2.Name = "pictureBox2";
			this.pictureBox2.Size = new System.Drawing.Size(296, 223);
			this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
			this.pictureBox2.TabIndex = 9;
			this.pictureBox2.TabStop = false;
			// 
			// panelSelfAV
			// 
			this.panelSelfAV.BackColor = System.Drawing.Color.Cyan;

⌨️ 快捷键说明

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