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

📄 myav.cs

📁 kuiMsg是一款用.net C# 开发的即时消息开源软件,适合.net即时消息软件开发者用。 主要功能: 支持文件传输(p2p); 支持GIF动画表情( 彻底消除闪屏 :) );
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using IMLibrary.AV;
using System.Net;

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

        private IMLibrary.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;
		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;//对方的公网端口
		private System.Windows.Forms.PictureBox picRemoteBack;
        private System.Windows.Forms.PictureBox picRemote;//发送请求的消息
        public int colorChange = 0;
        private PictureBox picLocal;

        /// <summary>
        /// 请求者ID
        /// </summary>
        public  string sendId = "";

		#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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MyAV));
            this.trackBarIn = new System.Windows.Forms.TrackBar();
            this.trackBarOut = new System.Windows.Forms.TrackBar();
            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.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.picLocal = 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();
            this.panel1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.picRemote)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.picRemoteBack)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
            this.panelSelfAV.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.picLocal)).BeginInit();
            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);
            // 
            // 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, 0);
            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(66, 48);
            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.StretchImage;
            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;
            this.panelSelfAV.Controls.Add(this.picLocal);
            this.panelSelfAV.Controls.Add(this.pictureBox1);
            this.panelSelfAV.Location = new System.Drawing.Point(123, 221);
            this.panelSelfAV.Name = "panelSelfAV";
            this.panelSelfAV.Size = new System.Drawing.Size(170, 134);
            this.panelSelfAV.TabIndex = 45;
            // 
            // pictureBox1
            // 
            this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
            this.pictureBox1.Location = new System.Drawing.Point(0, 0);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(170, 134);
            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.pictureBox1.TabIndex = 47;
            this.pictureBox1.TabStop = false;
            // 
            // picLocal
            // 
            this.picLocal.BackColor = System.Drawing.Color.WhiteSmoke;
            this.picLocal.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.picLocal.Location = new System.Drawing.Point(5, 8);
            this.picLocal.Name = "picLocal";

⌨️ 快捷键说明

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