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

📄 formnotice.cs

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

namespace LanMsg
{
	/// <summary>
	/// FormNotice 的摘要说明。
	/// </summary>
	public class FormNotice: DevComponents.DotNetBar.Office2007Form
    {
        #region

        private System.Windows.Forms.Panel panel4;
		private System.Windows.Forms.Panel panel3;
		private System.Windows.Forms.Panel panel2;
		private System.Windows.Forms.Panel panel1;
        private DevComponents.DotNetBar.Bar bar1;
		public  IMLibrary.MyExtRichTextBox RTBNoticeContent;
		private DevComponents.DotNetBar.LabelItem labelItem1;
		private DevComponents.DotNetBar.ButtonItem buttonItemRecord;
        private ContextMenuStrip contextMenuStrip;
        private IContainer components;
        private ToolStripMenuItem MenuItemCopy;
        private ToolStripSeparator toolStripSeparator1;
        private ToolStripMenuItem MenuItemSelAll;
        private DevComponents.DotNetBar.ButtonItem buttonItem2;
       // private System.ComponentModel.IContainer components;

        ///private ClassFormMain formMain=new ClassFormMain();

 

        public FormNotice()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
                //if(components != null)
                //{
                //    components.Dispose();
                //}
			}
			base.Dispose( disposing );
        }
        #endregion

        #region Windows 窗体设计器生成的代码
        /// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormNotice));
            this.panel4 = new System.Windows.Forms.Panel();
            this.panel3 = new System.Windows.Forms.Panel();
            this.panel2 = new System.Windows.Forms.Panel();
            this.panel1 = new System.Windows.Forms.Panel();
            this.bar1 = new DevComponents.DotNetBar.Bar();
            this.labelItem1 = new DevComponents.DotNetBar.LabelItem();
            this.buttonItem2 = new DevComponents.DotNetBar.ButtonItem();
            this.buttonItemRecord = new DevComponents.DotNetBar.ButtonItem();
            this.RTBNoticeContent = new IMLibrary.MyExtRichTextBox();
            this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.MenuItemCopy = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.MenuItemSelAll = new System.Windows.Forms.ToolStripMenuItem();
            ((System.ComponentModel.ISupportInitialize)(this.bar1)).BeginInit();
            this.contextMenuStrip.SuspendLayout();
            this.SuspendLayout();
            // 
            // panel4
            // 
            this.panel4.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.panel4.Location = new System.Drawing.Point(10, 315);
            this.panel4.Name = "panel4";
            this.panel4.Size = new System.Drawing.Size(480, 8);
            this.panel4.TabIndex = 58;
            // 
            // panel3
            // 
            this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
            this.panel3.Location = new System.Drawing.Point(10, 2);
            this.panel3.Name = "panel3";
            this.panel3.Size = new System.Drawing.Size(480, 8);
            this.panel3.TabIndex = 57;
            // 
            // panel2
            // 
            this.panel2.Dock = System.Windows.Forms.DockStyle.Right;
            this.panel2.Location = new System.Drawing.Point(490, 2);
            this.panel2.Name = "panel2";
            this.panel2.Size = new System.Drawing.Size(8, 321);
            this.panel2.TabIndex = 56;
            // 
            // panel1
            // 
            this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
            this.panel1.Location = new System.Drawing.Point(2, 2);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(8, 321);
            this.panel1.TabIndex = 55;
            // 
            // 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.labelItem1,
            this.buttonItem2,
            this.buttonItemRecord});
            this.bar1.ItemSpacing = 2;
            this.bar1.Location = new System.Drawing.Point(2, 323);
            this.bar1.Name = "bar1";
            this.bar1.Size = new System.Drawing.Size(496, 25);
            this.bar1.Stretch = true;
            this.bar1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
            this.bar1.TabIndex = 54;
            this.bar1.TabStop = false;
            this.bar1.Text = "barStatus";
            // 
            // labelItem1
            // 
            this.labelItem1.Name = "labelItem1";
            // 
            // buttonItem2
            // 
            this.buttonItem2.Enabled = false;
            this.buttonItem2.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItem2.Icon")));
            this.buttonItem2.ImagePaddingHorizontal = 8;
            this.buttonItem2.Name = "buttonItem2";
            // 
            // buttonItemRecord
            // 
            this.buttonItemRecord.ImagePaddingHorizontal = 8;
            this.buttonItemRecord.Name = "buttonItemRecord";
            this.buttonItemRecord.Text = "查看历史记录";
            // 
            // RTBNoticeContent
            // 
            this.RTBNoticeContent.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(175)))), ((int)(((byte)(201)))), ((int)(((byte)(235)))));
            this.RTBNoticeContent.ContextMenuStrip = this.contextMenuStrip;
            this.RTBNoticeContent.Dock = System.Windows.Forms.DockStyle.Fill;
            this.RTBNoticeContent.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.RTBNoticeContent.HiglightColor = IMLibrary.RtfColor.White;
            this.RTBNoticeContent.Location = new System.Drawing.Point(10, 10);
            this.RTBNoticeContent.MaxLength = 1000;
            this.RTBNoticeContent.Name = "RTBNoticeContent";
            this.RTBNoticeContent.ReadOnly = true;
            this.RTBNoticeContent.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
            this.RTBNoticeContent.Size = new System.Drawing.Size(480, 305);
            this.RTBNoticeContent.TabIndex = 59;
            this.RTBNoticeContent.Text = "";
            this.RTBNoticeContent.TextColor = IMLibrary.RtfColor.Black;
            this.RTBNoticeContent.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.RTBNoticeContent_LinkClicked);
            // 
            // contextMenuStrip
            // 
            this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.MenuItemCopy,
            this.toolStripSeparator1,
            this.MenuItemSelAll});
            this.contextMenuStrip.Name = "contextMenuStrip1";
            this.contextMenuStrip.Size = new System.Drawing.Size(153, 76);
            this.contextMenuStrip.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.contextMenuStrip_ItemClicked);
            // 
            // MenuItemCopy
            // 
            this.MenuItemCopy.Name = "MenuItemCopy";
            this.MenuItemCopy.Size = new System.Drawing.Size(152, 22);
            this.MenuItemCopy.Text = "复制(&C)";
            // 
            // toolStripSeparator1
            // 
            this.toolStripSeparator1.Name = "toolStripSeparator1";
            this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
            // 
            // MenuItemSelAll
            // 
            this.MenuItemSelAll.Name = "MenuItemSelAll";
            this.MenuItemSelAll.Size = new System.Drawing.Size(152, 22);
            this.MenuItemSelAll.Text = "全选(&A)";
            // 
            // FormNotice
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
            this.ClientSize = new System.Drawing.Size(500, 350);
            this.Controls.Add(this.RTBNoticeContent);
            this.Controls.Add(this.panel4);
            this.Controls.Add(this.panel3);
            this.Controls.Add(this.panel2);
            this.Controls.Add(this.panel1);
            this.Controls.Add(this.bar1);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MinimumSize = new System.Drawing.Size(500, 350);
            this.Name = "FormNotice";
            this.Padding = new System.Windows.Forms.Padding(2);
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "通知-消息";
            this.TopMost = true;
            ((System.ComponentModel.ISupportInitialize)(this.bar1)).EndInit();
            this.contextMenuStrip.ResumeLayout(false);
            this.ResumeLayout(false);

		}
		#endregion

		private void RTBNoticeContent_LinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e)
		{
			try
			{
				System.Diagnostics.Process.Start(e.LinkText);
			}
			catch 
			{
				MessageBox.Show("无法打开链接。","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}

		}
         

        private void contextMenuStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            switch (e.ClickedItem.Name)
            {
                case "MenuItemCopy":
                    this.RTBNoticeContent.Copy();
                    break;
                case "MenuItemPaset":
                    this.RTBNoticeContent.Paste();
                    break;
                case "MenuItemCut":
                    this.RTBNoticeContent.Cut();
                    break;
                case "MenuItemDel":
                    this.RTBNoticeContent.SelectedText = "";
                    break;
                case "MenuItemSelAll":
                    this.Focus();
                    this.RTBNoticeContent.SelectAll();
                    break;
            }
        }
	}
}

⌨️ 快捷键说明

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