FormNotice.cs
上传用户:lqb116
上传日期:2014-04-04
资源大小:2712k
文件大小:14k
源码类别:

P2P编程

开发平台:

C#

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. namespace LanMsg
  7. {
  8. /// <summary>
  9. /// FormNotice 的摘要说明。
  10. /// </summary>
  11. public class FormNotice: DevComponents.DotNetBar.Office2007RibbonForm 
  12. {
  13. private System.Windows.Forms.Panel panel4;
  14. private System.Windows.Forms.Panel panel3;
  15. private System.Windows.Forms.Panel panel2;
  16. private System.Windows.Forms.Panel panel1;
  17. private DevComponents.DotNetBar.Bar bar1;
  18. private DevComponents.DotNetBar.RibbonControl ribbonControl1;
  19. private DevComponents.DotNetBar.ButtonItem buttonItem1;
  20. public LanMsg.MyExtRichTextBox RTBNoticeContent;
  21. private DevComponents.DotNetBar.LabelItem labelItem1;
  22. private System.ComponentModel.IContainer components;
  23. private DevComponents.DotNetBar.ButtonItem buttonItemRecord;
  24. private DevComponents.DotNetBar.ButtonItem buttonItem2;
  25. private DevComponents.DotNetBar.DotNetBarManager dotNetBarManager1;
  26. private DevComponents.DotNetBar.DockSite barLeftDockSite;
  27. private DevComponents.DotNetBar.DockSite barRightDockSite;
  28. private DevComponents.DotNetBar.DockSite barTopDockSite;
  29. private DevComponents.DotNetBar.DockSite barBottomDockSite;
  30. private ClassFormMain formMain=new ClassFormMain();
  31. public FormNotice()
  32. {
  33. //
  34. // Windows 窗体设计器支持所必需的
  35. //
  36. InitializeComponent();
  37. //
  38. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  39. //
  40. }
  41. /// <summary>
  42. /// 清理所有正在使用的资源。
  43. /// </summary>
  44. protected override void Dispose( bool disposing )
  45. {
  46. if( disposing )
  47. {
  48. if(components != null)
  49. {
  50. components.Dispose();
  51. }
  52. }
  53. base.Dispose( disposing );
  54. }
  55. #region Windows 窗体设计器生成的代码
  56. /// <summary>
  57. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  58. /// 此方法的内容。
  59. /// </summary>
  60. private void InitializeComponent()
  61. {
  62. this.components = new System.ComponentModel.Container();
  63. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormNotice));
  64. this.panel4 = new System.Windows.Forms.Panel();
  65. this.panel3 = new System.Windows.Forms.Panel();
  66. this.panel2 = new System.Windows.Forms.Panel();
  67. this.panel1 = new System.Windows.Forms.Panel();
  68. this.bar1 = new DevComponents.DotNetBar.Bar();
  69. this.labelItem1 = new DevComponents.DotNetBar.LabelItem();
  70. this.buttonItem2 = new DevComponents.DotNetBar.ButtonItem();
  71. this.buttonItemRecord = new DevComponents.DotNetBar.ButtonItem();
  72. this.ribbonControl1 = new DevComponents.DotNetBar.RibbonControl();
  73. this.buttonItem1 = new DevComponents.DotNetBar.ButtonItem();
  74. this.RTBNoticeContent = new LanMsg.MyExtRichTextBox();
  75. this.dotNetBarManager1 = new DevComponents.DotNetBar.DotNetBarManager(this.components);
  76. this.barBottomDockSite = new DevComponents.DotNetBar.DockSite();
  77. this.barLeftDockSite = new DevComponents.DotNetBar.DockSite();
  78. this.barRightDockSite = new DevComponents.DotNetBar.DockSite();
  79. this.barTopDockSite = new DevComponents.DotNetBar.DockSite();
  80. ((System.ComponentModel.ISupportInitialize)(this.bar1)).BeginInit();
  81. this.SuspendLayout();
  82. // 
  83. // panel4
  84. // 
  85. this.panel4.Dock = System.Windows.Forms.DockStyle.Bottom;
  86. this.panel4.Location = new System.Drawing.Point(10, 315);
  87. this.panel4.Name = "panel4";
  88. this.panel4.Size = new System.Drawing.Size(480, 8);
  89. this.panel4.TabIndex = 58;
  90. // 
  91. // panel3
  92. // 
  93. this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
  94. this.panel3.Location = new System.Drawing.Point(10, 24);
  95. this.panel3.Name = "panel3";
  96. this.panel3.Size = new System.Drawing.Size(480, 8);
  97. this.panel3.TabIndex = 57;
  98. // 
  99. // panel2
  100. // 
  101. this.panel2.Dock = System.Windows.Forms.DockStyle.Right;
  102. this.panel2.Location = new System.Drawing.Point(490, 24);
  103. this.panel2.Name = "panel2";
  104. this.panel2.Size = new System.Drawing.Size(8, 299);
  105. this.panel2.TabIndex = 56;
  106. // 
  107. // panel1
  108. // 
  109. this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
  110. this.panel1.Location = new System.Drawing.Point(2, 24);
  111. this.panel1.Name = "panel1";
  112. this.panel1.Size = new System.Drawing.Size(8, 299);
  113. this.panel1.TabIndex = 55;
  114. // 
  115. // bar1
  116. // 
  117. this.bar1.AccessibleDescription = "DotNetBar Bar (bar1)";
  118. this.bar1.AccessibleName = "DotNetBar Bar";
  119. this.bar1.AccessibleRole = System.Windows.Forms.AccessibleRole.StatusBar;
  120. this.bar1.AntiAlias = true;
  121. this.bar1.Dock = System.Windows.Forms.DockStyle.Bottom;
  122. this.bar1.GrabHandleStyle = DevComponents.DotNetBar.eGrabHandleStyle.ResizeHandle;
  123. this.bar1.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
  124. this.labelItem1,
  125. this.buttonItem2,
  126. this.buttonItemRecord});
  127. this.bar1.ItemSpacing = 2;
  128. this.bar1.Location = new System.Drawing.Point(2, 323);
  129. this.bar1.Name = "bar1";
  130. this.bar1.Size = new System.Drawing.Size(496, 25);
  131. this.bar1.Stretch = true;
  132. this.bar1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
  133. this.bar1.TabIndex = 54;
  134. this.bar1.TabStop = false;
  135. this.bar1.Text = "barStatus";
  136. this.bar1.Click += new System.EventHandler(this.bar1_Click);
  137. // 
  138. // labelItem1
  139. // 
  140. this.labelItem1.BorderType = DevComponents.DotNetBar.eBorderType.None;
  141. this.labelItem1.Name = "labelItem1";
  142. // 
  143. // buttonItem2
  144. // 
  145. this.buttonItem2.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItem2.Icon")));
  146. this.buttonItem2.Name = "buttonItem2";
  147. // 
  148. // buttonItemRecord
  149. // 
  150. this.buttonItemRecord.Name = "buttonItemRecord";
  151. this.buttonItemRecord.Text = "查看历史记录";
  152. this.buttonItemRecord.Click += new System.EventHandler(this.buttonItemRecord_Click);
  153. // 
  154. // ribbonControl1
  155. // 
  156. this.ribbonControl1.BackColor = System.Drawing.SystemColors.Control;
  157. this.ribbonControl1.CaptionVisible = true;
  158. this.ribbonControl1.Dock = System.Windows.Forms.DockStyle.Top;
  159. this.ribbonControl1.DockPadding.Bottom = 2;
  160. this.ribbonControl1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  161. this.ribbonControl1.KeyTipsFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
  162. this.ribbonControl1.Location = new System.Drawing.Point(2, 2);
  163. this.ribbonControl1.MdiSystemItemVisible = false;
  164. this.ribbonControl1.Name = "ribbonControl1";
  165. this.ribbonControl1.QuickToolbarItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
  166.   this.buttonItem1});
  167. this.ribbonControl1.RibbonStripIndent = 55;
  168. this.ribbonControl1.Size = new System.Drawing.Size(496, 22);
  169. this.ribbonControl1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
  170. this.ribbonControl1.TabGroupHeight = 15;
  171. this.ribbonControl1.TabIndex = 53;
  172. // 
  173. // buttonItem1
  174. // 
  175. this.buttonItem1.Icon = ((System.Drawing.Icon)(resources.GetObject("buttonItem1.Icon")));
  176. this.buttonItem1.Name = "buttonItem1";
  177. // 
  178. // RTBNoticeContent
  179. // 
  180. this.RTBNoticeContent.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(175)), ((System.Byte)(201)), ((System.Byte)(235)));
  181. this.dotNetBarManager1.SetContextMenuEx(this.RTBNoticeContent, "ButtonItem1");
  182. this.RTBNoticeContent.Dock = System.Windows.Forms.DockStyle.Fill;
  183. this.RTBNoticeContent.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
  184. this.RTBNoticeContent.HiglightColor = LanMsg.RtfColor.White;
  185. this.RTBNoticeContent.Location = new System.Drawing.Point(10, 32);
  186. this.RTBNoticeContent.MaxLength = 1000;
  187. this.RTBNoticeContent.Name = "RTBNoticeContent";
  188. this.RTBNoticeContent.ReadOnly = true;
  189. this.RTBNoticeContent.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
  190. this.RTBNoticeContent.Size = new System.Drawing.Size(480, 283);
  191. this.RTBNoticeContent.TabIndex = 59;
  192. this.RTBNoticeContent.Text = "";
  193. this.RTBNoticeContent.TextColor = LanMsg.RtfColor.Black;
  194. this.RTBNoticeContent.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.RTBNoticeContent_LinkClicked);
  195. // 
  196. // dotNetBarManager1
  197. // 
  198. this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.F1);
  199. this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlC);
  200. this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlA);
  201. this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlV);
  202. this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlX);
  203. this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlZ);
  204. this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.CtrlY);
  205. this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.Del);
  206. this.dotNetBarManager1.AutoDispatchShortcuts.Add(DevComponents.DotNetBar.eShortcut.Ins);
  207. this.dotNetBarManager1.BottomDockSite = this.barBottomDockSite;
  208. this.dotNetBarManager1.DefinitionName = "FormNotice.dotNetBarManager1.xml";
  209. this.dotNetBarManager1.EnableFullSizeDock = false;
  210. this.dotNetBarManager1.LeftDockSite = this.barLeftDockSite;
  211. this.dotNetBarManager1.ParentForm = this;
  212. this.dotNetBarManager1.RightDockSite = this.barRightDockSite;
  213. this.dotNetBarManager1.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2003;
  214. this.dotNetBarManager1.ThemeAware = false;
  215. this.dotNetBarManager1.TopDockSite = this.barTopDockSite;
  216. this.dotNetBarManager1.ItemClick += new System.EventHandler(this.dotNetBarManager1_ItemClick);
  217. // 
  218. // barBottomDockSite
  219. // 
  220. this.barBottomDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window;
  221. this.barBottomDockSite.Dock = System.Windows.Forms.DockStyle.Bottom;
  222. this.barBottomDockSite.Location = new System.Drawing.Point(2, 348);
  223. this.barBottomDockSite.Name = "barBottomDockSite";
  224. this.barBottomDockSite.NeedsLayout = false;
  225. this.barBottomDockSite.Size = new System.Drawing.Size(496, 0);
  226. this.barBottomDockSite.TabIndex = 63;
  227. this.barBottomDockSite.TabStop = false;
  228. // 
  229. // barLeftDockSite
  230. // 
  231. this.barLeftDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window;
  232. this.barLeftDockSite.Dock = System.Windows.Forms.DockStyle.Left;
  233. this.barLeftDockSite.Location = new System.Drawing.Point(2, 2);
  234. this.barLeftDockSite.Name = "barLeftDockSite";
  235. this.barLeftDockSite.NeedsLayout = false;
  236. this.barLeftDockSite.Size = new System.Drawing.Size(0, 346);
  237. this.barLeftDockSite.TabIndex = 60;
  238. this.barLeftDockSite.TabStop = false;
  239. // 
  240. // barRightDockSite
  241. // 
  242. this.barRightDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window;
  243. this.barRightDockSite.Dock = System.Windows.Forms.DockStyle.Right;
  244. this.barRightDockSite.Location = new System.Drawing.Point(498, 2);
  245. this.barRightDockSite.Name = "barRightDockSite";
  246. this.barRightDockSite.NeedsLayout = false;
  247. this.barRightDockSite.Size = new System.Drawing.Size(0, 346);
  248. this.barRightDockSite.TabIndex = 61;
  249. this.barRightDockSite.TabStop = false;
  250. // 
  251. // barTopDockSite
  252. // 
  253. this.barTopDockSite.AccessibleRole = System.Windows.Forms.AccessibleRole.Window;
  254. this.barTopDockSite.Dock = System.Windows.Forms.DockStyle.Top;
  255. this.barTopDockSite.Location = new System.Drawing.Point(2, 2);
  256. this.barTopDockSite.Name = "barTopDockSite";
  257. this.barTopDockSite.NeedsLayout = false;
  258. this.barTopDockSite.Size = new System.Drawing.Size(496, 0);
  259. this.barTopDockSite.TabIndex = 62;
  260. this.barTopDockSite.TabStop = false;
  261. // 
  262. // FormNotice
  263. // 
  264. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  265. this.ClientSize = new System.Drawing.Size(500, 350);
  266. this.Controls.Add(this.RTBNoticeContent);
  267. this.Controls.Add(this.panel4);
  268. this.Controls.Add(this.panel3);
  269. this.Controls.Add(this.panel2);
  270. this.Controls.Add(this.panel1);
  271. this.Controls.Add(this.bar1);
  272. this.Controls.Add(this.ribbonControl1);
  273. this.Controls.Add(this.barLeftDockSite);
  274. this.Controls.Add(this.barRightDockSite);
  275. this.Controls.Add(this.barTopDockSite);
  276. this.Controls.Add(this.barBottomDockSite);
  277. this.DockPadding.Bottom = 2;
  278. this.DockPadding.Left = 2;
  279. this.DockPadding.Right = 2;
  280. this.DockPadding.Top = 2;
  281. this.MinimumSize = new System.Drawing.Size(500, 350);
  282. this.Name = "FormNotice";
  283. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  284. this.Text = "通知-消息";
  285. this.TopMost = true;
  286. ((System.ComponentModel.ISupportInitialize)(this.bar1)).EndInit();
  287. this.ResumeLayout(false);
  288. }
  289. #endregion
  290. private void RTBNoticeContent_LinkClicked(object sender, System.Windows.Forms.LinkClickedEventArgs e)
  291. {
  292. try
  293. {
  294. System.Diagnostics.Process.Start(e.LinkText);
  295. }
  296. catch 
  297. {
  298. MessageBox.Show("无法打开链接。","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
  299. }
  300. }
  301. private void bar1_Click(object sender, System.EventArgs e)
  302. {
  303. }
  304. private void buttonItemRecord_Click(object sender, System.EventArgs e)
  305. {
  306.    this.formMain.formMain.OpenMsgMis("Notice");
  307. }
  308. private void dotNetBarManager1_ItemClick(object sender, System.EventArgs e)
  309. {
  310. switch((sender as DevComponents.DotNetBar.ButtonItem ).Name )
  311. {
  312. case "复制" :
  313. if(this.RTBNoticeContent.Focus())
  314. this.RTBNoticeContent.Copy (); 
  315. break;
  316. case "全选" :
  317. if(this.RTBNoticeContent.Focus())
  318. this.RTBNoticeContent.SelectAll (); 
  319. break;
  320. }
  321. }
  322. }
  323. }