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

📄 formmain.cs

📁 该即时通讯系统系统能够实现像QQ一样的通讯功能
💻 CS
📖 第 1 页 / 共 4 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using DevComponents.DotNetBar.Rendering;
using System.Net;
using LanMsg.CustomUIControls;

namespace LanMsg
{
	/// <summary>
	/// Form2 的摘要说明。
	/// </summary>
	public class FormMain :DevComponents.DotNetBar.Office2007RibbonForm //System.Windows.Forms.Form  
	{
		private DevComponents.DotNetBar.TabItem tabItem1;

		private DevComponents.DotNetBar.ItemContainer menuFileContainer;
		private DevComponents.DotNetBar.ItemContainer menuFileTwoColumnContainer;
		private DevComponents.DotNetBar.ItemContainer menuFileItems;
		private DevComponents.DotNetBar.ButtonItem buttonFileSaveAs;

		private DevComponents.DotNetBar.ItemContainer menuFileMRU;
		private DevComponents.DotNetBar.LabelItem labelItem8;
		private DevComponents.DotNetBar.ItemContainer menuFileBottomContainer;
		private DevComponents.DotNetBar.ButtonItem buttonOptions;
		private DevComponents.DotNetBar.ButtonItem buttonExit;
		private DevComponents.DotNetBar.Bar bar1;
		private DevComponents.DotNetBar.LabelItem labelStatus;
		internal DevComponents.DotNetBar.LabelItem labelPosition;
		private DevComponents.DotNetBar.RibbonControl ribbonControl1;
		private DevComponents.DotNetBar.RibbonTabItemGroup ribbonTabItemGroup1;
		internal System.Windows.Forms.ImageList imageList1;
		private System.ComponentModel.IContainer components;
		private DevComponents.DotNetBar.ButtonItem butMenuMain;
		private DevComponents.DotNetBar.ButtonItem butMeState;
		private DevComponents.DotNetBar.ButtonItem butMenuMainExit;
		private DevComponents.DotNetBar.RibbonPanel ribbonPanel1;
		private System.Windows.Forms.Panel panel1;
		private System.Windows.Forms.Panel panel2;
		private System.Windows.Forms.Panel panel3;
		internal System.Windows.Forms.TreeView TvUsers;
		private DevComponents.DotNetBar.RibbonTabItem LabselfName;
		public ClassUserInfo selfInfo=new ClassUserInfo();
		internal System.Windows.Forms.ImageList imageListFace;
		private System.Windows.Forms.Timer timerCheckOnlinState;//保存用户自己的信息
		public Controls.ClassForms forms=new LanMsg.Controls.ClassForms(); 
		private IPAddress ServerIP=IPAddress.Parse("127.0.0.1");//服务器IP192.168.1.100
		private int ServerPort=3211;//服务器端口
		private LanMsg.Controls.SockUDP sockUDP1;
		private DevComponents.DotNetBar.ButtonItem butMsgSendGourp;
		private System.Windows.Forms.NotifyIcon NotifyIcon;
		private DevComponents.DotNetBar.ButtonItem butMsgMis;


		public  Controls.ClassUsers MyUsers =new  Controls.ClassUsers();
		private DevComponents.DotNetBar.ButtonItem buttonItemState1;
		private DevComponents.DotNetBar.ButtonItem buttonItemState2;
		private DevComponents.DotNetBar.ButtonItem buttonItemState3;
		private DevComponents.DotNetBar.ButtonItem buttonItemState4;
		private DevComponents.DotNetBar.ButtonItem buttonItemState5;
		private DevComponents.DotNetBar.ButtonItem buttonItemState6;
		private DevComponents.DotNetBar.ButtonItem buttonItemClose;
		private DevComponents.DotNetBar.ButtonItem butForFormSetting;

		private LanMsg.ClassFormMain formmain=new ClassFormMain();

        public  bool IsWindowsExit=false;

		public  LanMsg.ClassOptionData optDB;
		private DevComponents.DotNetBar.ButtonItem butSendMsg;
		private DevComponents.DotNetBar.ButtonItem butOpenShared;
		private DevComponents.DotNetBar.ButtonItem butSendFile;
		private DevComponents.DotNetBar.ButtonItem ButAbout;

		LanMsg.FormUpdate fUpdate=new FormUpdate();

		public FormMain()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			//DisableX(this);
			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
			for(int i=0;i<96;i++)
				this.imageListFace.Images.Add(System.Drawing.Image.FromStream (System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("LanMsg.Resources."+ i.ToString()  +".gif")) );
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			this.sendMsgToServer(new LanMsg.Controls.ClassMsg(2,selfInfo.ID,System.Text.Encoding.Unicode.GetBytes("0")));
			this.sendMsgToAllUser(new LanMsg.Controls.ClassMsg(0,this.selfInfo.ID, null));
			this.sockUDP1.CloseSock();
			AppExit();

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

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormMain));
			this.tabItem1 = new DevComponents.DotNetBar.TabItem(this.components);
			this.menuFileContainer = new DevComponents.DotNetBar.ItemContainer();
			this.menuFileTwoColumnContainer = new DevComponents.DotNetBar.ItemContainer();
			this.menuFileItems = new DevComponents.DotNetBar.ItemContainer();
			this.menuFileMRU = new DevComponents.DotNetBar.ItemContainer();
			this.menuFileBottomContainer = new DevComponents.DotNetBar.ItemContainer();
			this.buttonOptions = new DevComponents.DotNetBar.ButtonItem();
			this.buttonExit = new DevComponents.DotNetBar.ButtonItem();
			this.buttonFileSaveAs = new DevComponents.DotNetBar.ButtonItem();
			this.labelItem8 = new DevComponents.DotNetBar.LabelItem();
			this.bar1 = new DevComponents.DotNetBar.Bar();
			this.labelStatus = new DevComponents.DotNetBar.LabelItem();
			this.labelPosition = new DevComponents.DotNetBar.LabelItem();
			this.ribbonControl1 = new DevComponents.DotNetBar.RibbonControl();
			this.ribbonPanel1 = new DevComponents.DotNetBar.RibbonPanel();
			this.LabselfName = new DevComponents.DotNetBar.RibbonTabItem();
			this.butMenuMain = new DevComponents.DotNetBar.ButtonItem();
			this.butSendMsg = new DevComponents.DotNetBar.ButtonItem();
			this.butSendFile = new DevComponents.DotNetBar.ButtonItem();
			this.butOpenShared = new DevComponents.DotNetBar.ButtonItem();
			this.butMeState = new DevComponents.DotNetBar.ButtonItem();
			this.buttonItemState1 = new DevComponents.DotNetBar.ButtonItem();
			this.buttonItemState2 = new DevComponents.DotNetBar.ButtonItem();
			this.buttonItemState3 = new DevComponents.DotNetBar.ButtonItem();
			this.buttonItemState4 = new DevComponents.DotNetBar.ButtonItem();
			this.buttonItemState5 = new DevComponents.DotNetBar.ButtonItem();
			this.buttonItemState6 = new DevComponents.DotNetBar.ButtonItem();
			this.butMsgSendGourp = new DevComponents.DotNetBar.ButtonItem();
			this.butMsgMis = new DevComponents.DotNetBar.ButtonItem();
			this.butForFormSetting = new DevComponents.DotNetBar.ButtonItem();
			this.buttonItemClose = new DevComponents.DotNetBar.ButtonItem();
			this.butMenuMainExit = new DevComponents.DotNetBar.ButtonItem();
			this.ButAbout = new DevComponents.DotNetBar.ButtonItem();
			this.ribbonTabItemGroup1 = new DevComponents.DotNetBar.RibbonTabItemGroup();
			this.imageList1 = new System.Windows.Forms.ImageList(this.components);
			this.panel1 = new System.Windows.Forms.Panel();
			this.panel2 = new System.Windows.Forms.Panel();
			this.panel3 = new System.Windows.Forms.Panel();
			this.TvUsers = new System.Windows.Forms.TreeView();
			this.imageListFace = new System.Windows.Forms.ImageList(this.components);
			this.timerCheckOnlinState = new System.Windows.Forms.Timer(this.components);
			this.sockUDP1 = new LanMsg.Controls.SockUDP(this.components);
			this.NotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
			((System.ComponentModel.ISupportInitialize)(this.bar1)).BeginInit();
			this.ribbonControl1.SuspendLayout();
			this.SuspendLayout();
			// 
			// tabItem1
			// 
			this.tabItem1.Name = "tabItem1";
			this.tabItem1.Text = "tabItem1";
			// 
			// menuFileContainer
			// 
			this.menuFileContainer.LayoutOrientation = DevComponents.DotNetBar.eOrientation.Vertical;
			this.menuFileContainer.MinimumSize = new System.Drawing.Size(0, 0);
			this.menuFileContainer.Name = "menuFileContainer";
			this.menuFileContainer.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
																								this.menuFileTwoColumnContainer,
																								this.menuFileBottomContainer});
			// 
			// menuFileTwoColumnContainer
			// 
			// 
			// menuFileTwoColumnContainer.BackgroundStyle
			// 
			this.menuFileTwoColumnContainer.BackgroundStyle.PaddingBottom = 2;
			this.menuFileTwoColumnContainer.BackgroundStyle.PaddingLeft = 2;
			this.menuFileTwoColumnContainer.BackgroundStyle.PaddingRight = 2;
			this.menuFileTwoColumnContainer.BackgroundStyle.PaddingTop = 2;
			this.menuFileTwoColumnContainer.ItemSpacing = 0;
			this.menuFileTwoColumnContainer.MinimumSize = new System.Drawing.Size(0, 0);
			this.menuFileTwoColumnContainer.Name = "menuFileTwoColumnContainer";
			this.menuFileTwoColumnContainer.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
																										 this.menuFileItems,
																										 this.menuFileMRU});
			// 
			// menuFileItems
			// 
			this.menuFileItems.MinimumSize = new System.Drawing.Size(0, 0);
			this.menuFileItems.Name = "menuFileItems";
			// 
			// menuFileMRU
			// 
			this.menuFileMRU.LayoutOrientation = DevComponents.DotNetBar.eOrientation.Vertical;
			this.menuFileMRU.MinimumSize = new System.Drawing.Size(180, 0);
			this.menuFileMRU.Name = "menuFileMRU";
			// 
			// menuFileBottomContainer
			// 
			this.menuFileBottomContainer.HorizontalItemAlignment = DevComponents.DotNetBar.eHorizontalItemsAlignment.Right;
			this.menuFileBottomContainer.MinimumSize = new System.Drawing.Size(0, 0);
			this.menuFileBottomContainer.Name = "menuFileBottomContainer";
			this.menuFileBottomContainer.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
																									  this.buttonOptions,
																									  this.buttonExit});
			// 
			// buttonOptions
			// 
			this.buttonOptions.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
			this.buttonOptions.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
			this.buttonOptions.Image = ((System.Drawing.Image)(resources.GetObject("buttonOptions.Image")));
			this.buttonOptions.Name = "buttonOptions";
			this.buttonOptions.SubItemsExpandWidth = 24;
			this.buttonOptions.Text = "RibbonPad Opt&ions";
			// 
			// buttonExit
			// 
			this.buttonExit.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
			this.buttonExit.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
			this.buttonExit.Image = ((System.Drawing.Image)(resources.GetObject("buttonExit.Image")));
			this.buttonExit.Name = "buttonExit";
			this.buttonExit.SubItemsExpandWidth = 24;
			this.buttonExit.Text = "E&xit RibbonPad";
			// 
			// buttonFileSaveAs
			// 
			this.buttonFileSaveAs.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
			this.buttonFileSaveAs.Image = ((System.Drawing.Image)(resources.GetObject("buttonFileSaveAs.Image")));
			this.buttonFileSaveAs.Name = "buttonFileSaveAs";
			this.buttonFileSaveAs.SubItemsExpandWidth = 24;
			this.buttonFileSaveAs.Text = "&Save As...";
			// 
			// labelItem8
			// 
			this.labelItem8.BorderSide = DevComponents.DotNetBar.eBorderSide.Bottom;
			this.labelItem8.BorderType = DevComponents.DotNetBar.eBorderType.Etched;
			this.labelItem8.Name = "labelItem8";
			this.labelItem8.PaddingBottom = 2;
			this.labelItem8.PaddingTop = 2;
			this.labelItem8.Stretch = true;
			this.labelItem8.Text = "Recent Documents";
			// 
			// bar1
			// 
			this.bar1.AccessibleDescription = "DotNetBar Bar (bar1)";
			this.bar1.AccessibleName = "DotNetBar Bar";
			this.bar1.AccessibleRole = System.Windows.Forms.AccessibleRole.StatusBar;
			this.bar1.AntiAlias = true;
			this.bar1.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.bar1.GrabHandleStyle = DevComponents.DotNetBar.eGrabHandleStyle.ResizeHandle;
			this.bar1.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
																				this.labelStatus,
																				this.labelPosition});
			this.bar1.ItemSpacing = 2;
			this.bar1.Location = new System.Drawing.Point(2, 325);
			this.bar1.Name = "bar1";
			this.bar1.Size = new System.Drawing.Size(172, 17);
			this.bar1.Stretch = true;
			this.bar1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
			this.bar1.TabIndex = 10;
			this.bar1.TabStop = false;
			this.bar1.Text = "barStatus";
			// 
			// labelStatus
			// 
			this.labelStatus.BorderType = DevComponents.DotNetBar.eBorderType.None;
			this.labelStatus.Name = "labelStatus";
			this.labelStatus.PaddingLeft = 2;
			this.labelStatus.PaddingRight = 2;
			this.labelStatus.SingleLineColor = System.Drawing.Color.FromArgb(((System.Byte)(59)), ((System.Byte)(97)), ((System.Byte)(156)));
			this.labelStatus.Stretch = true;
			// 
			// labelPosition
			// 
			this.labelPosition.BorderType = DevComponents.DotNetBar.eBorderType.None;
			this.labelPosition.Name = "labelPosition";
			this.labelPosition.PaddingLeft = 2;
			this.labelPosition.PaddingRight = 2;
			this.labelPosition.SingleLineColor = System.Drawing.Color.FromArgb(((System.Byte)(59)), ((System.Byte)(97)), ((System.Byte)(156)));
			this.labelPosition.Width = 100;
			// 
			// ribbonControl1
			// 
			this.ribbonControl1.BackColor = System.Drawing.SystemColors.Control;
			this.ribbonControl1.CaptionVisible = true;
			this.ribbonControl1.CategorizeMode = DevComponents.DotNetBar.eCategorizeMode.Categories;
			this.ribbonControl1.Controls.Add(this.ribbonPanel1);
			this.ribbonControl1.Dock = System.Windows.Forms.DockStyle.Top;
			this.ribbonControl1.DockPadding.Bottom = 2;
			this.ribbonControl1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.ribbonControl1.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
																						  this.LabselfName});
			this.ribbonControl1.KeyTipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.ribbonControl1.Location = new System.Drawing.Point(2, 2);
			this.ribbonControl1.MdiSystemItemVisible = false;
			this.ribbonControl1.Name = "ribbonControl1";
			this.ribbonControl1.QuickToolbarItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
																									  this.butMenuMain});
			this.ribbonControl1.RibbonStripIndent = 55;
			this.ribbonControl1.Size = new System.Drawing.Size(172, 46);
			this.ribbonControl1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
			this.ribbonControl1.TabGroupHeight = 14;
			this.ribbonControl1.TabGroups.AddRange(new DevComponents.DotNetBar.RibbonTabItemGroup[] {
																										this.ribbonTabItemGroup1});
			this.ribbonControl1.TabGroupsVisible = true;
			this.ribbonControl1.TabIndex = 11;
			// 
			// ribbonPanel1
			// 
			this.ribbonPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
			this.ribbonPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.ribbonPanel1.DockPadding.Bottom = 3;
			this.ribbonPanel1.DockPadding.Left = 3;
			this.ribbonPanel1.DockPadding.Right = 3;
			this.ribbonPanel1.Location = new System.Drawing.Point(0, 48);
			this.ribbonPanel1.Name = "ribbonPanel1";
			this.ribbonPanel1.Size = new System.Drawing.Size(172, 0);
			this.ribbonPanel1.TabIndex = 1;
			// 
			// LabselfName
			// 
			this.LabselfName.Checked = true;
			this.LabselfName.Name = "LabselfName";
			this.LabselfName.Panel = this.ribbonPanel1;
			this.LabselfName.Text = "正在登录...";
			this.LabselfName.TextChanged += new System.EventHandler(this.LabselfName_TextChanged);
			// 
			// butMenuMain
			// 
			this.butMenuMain.Image = ((System.Drawing.Image)(resources.GetObject("butMenuMain.Image")));
			this.butMenuMain.Name = "butMenuMain";
			this.butMenuMain.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
																						  this.butSendMsg,
																						  this.butSendFile,
																						  this.butOpenShared,
																						  this.butMeState,
																						  this.butMsgSendGourp,
																						  this.butMsgMis,
																						  this.butForFormSetting,
																						  this.buttonItemClose,
																						  this.butMenuMainExit,
																						  this.ButAbout});
			this.butMenuMain.Text = "buttonItem1";
			this.butMenuMain.PopupClose += new System.EventHandler(this.butMenuMain_PopupClose);
			// 
			// butSendMsg
			// 
			this.butSendMsg.Name = "butSendMsg";
			this.butSendMsg.Text = "发送消息(&M)";
			this.butSendMsg.Visible = false;
			this.butSendMsg.Click += new System.EventHandler(this.butSendMsg_Click);

⌨️ 快捷键说明

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