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

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. /// FormMsgMis 的摘要说明。
  10. /// </summary>
  11. public class FormMsgMis : System.Windows.Forms.Form
  12. {
  13. private System.Windows.Forms.MainMenu mainMenu1;
  14. private System.Windows.Forms.MenuItem menuItem3;
  15. private System.Windows.Forms.ToolBar toolBar1;
  16. private System.Windows.Forms.StatusBar statusBar1;
  17. private System.Windows.Forms.Panel panel2;
  18. private System.Windows.Forms.Panel panel1;
  19. private System.Windows.Forms.Panel panel3;
  20. private System.Windows.Forms.Panel panel4;
  21. private System.Windows.Forms.Splitter splitter1;
  22. private System.Windows.Forms.Panel panel5;
  23. private System.Windows.Forms.TabControl tabControl1;
  24. private System.Windows.Forms.TabPage tabPage1;
  25. public LanMsg.MyExtRichTextBox RTBRecord;
  26. private System.Windows.Forms.TabPage tabPage2;
  27. private System.Windows.Forms.ListView listView1;
  28. private System.Windows.Forms.ColumnHeader columnHeader1;
  29. private System.Windows.Forms.ColumnHeader columnHeader2;
  30. private System.Windows.Forms.ColumnHeader columnHeader3;
  31. private System.Windows.Forms.TreeView TV_user;
  32. private System.Windows.Forms.MenuItem meuFileExit;
  33. private System.Windows.Forms.MenuItem menFileExport;
  34. private System.Windows.Forms.MenuItem menViewRefresh;
  35. private System.ComponentModel.IContainer components;
  36. private System.Windows.Forms.ToolBarButton ButUp;
  37. private System.Windows.Forms.ToolBarButton ButDown;
  38. private System.Windows.Forms.ToolBarButton ButFirst;
  39. private System.Windows.Forms.ToolBarButton ButLast;
  40. private System.Windows.Forms.StatusBarPanel statusBarPanel1;
  41. internal System.Windows.Forms.ImageList imageList1;
  42. private System.Windows.Forms.StatusBarPanel statusBarPanel2;
  43. private System.Windows.Forms.ToolBarButton ButExit;
  44. private System.Windows.Forms.ToolBarButton toolBarButton1;
  45. private System.Windows.Forms.ToolBarButton toolBarButton2;
  46. private System.Windows.Forms.ToolBarButton ButDelRecord;
  47. private System.Windows.Forms.ContextMenu contextMenu1;
  48. private System.Windows.Forms.MenuItem menuItemCopy;
  49. private System.Windows.Forms.MenuItem menuItem2;
  50. private System.Windows.Forms.MenuItem menuItemSelectAll;
  51. private System.Windows.Forms.MenuItem menuItem7;
  52. private System.Windows.Forms.MenuItem menuItemEdit;
  53. private System.Windows.Forms.MenuItem menuItemEditCopy;
  54. private System.Windows.Forms.MenuItem menuItemEditSelectAll;
  55. private System.Windows.Forms.MenuItem menuItem4;
  56. private System.Windows.Forms.MenuItem menuItemEditLast;
  57. private System.Windows.Forms.MenuItem menuItemEditDown;
  58. private System.Windows.Forms.MenuItem menuItemEditFUp;
  59. private System.Windows.Forms.MenuItem menuItemEditFirst;
  60. private System.Windows.Forms.MenuItem menuItemFile;
  61. private System.Windows.Forms.MenuItem menuItemView;
  62. private LanMsg.Controls.OfficeMenus officeMenus1;
  63. private System.Windows.Forms.MenuItem menuItemEditDelRecord;
  64. private System.Windows.Forms.MenuItem menuItem5;
  65. private ClassFormMain FormMain =new ClassFormMain();
  66. public FormMsgMis()
  67. {
  68. //
  69. // Windows 窗体设计器支持所必需的
  70. //
  71. InitializeComponent();
  72.             this.TV_user.ImageList=this.FormMain.formMain.imageList1;
  73. this.TV_user.Nodes[0].ImageIndex=17;this.TV_user.Nodes[0].SelectedImageIndex=17;
  74. this.TV_user.Nodes[1].ImageIndex=16;this.TV_user.Nodes[1].SelectedImageIndex=16;
  75. for(int i=0;i<this.TV_user.Nodes[0].Nodes.Count ;i++)
  76. {
  77. this.TV_user.Nodes[0].Nodes[i].ImageIndex=14;
  78.                 this.TV_user.Nodes[0].Nodes[i].SelectedImageIndex=15;
  79. }
  80. //
  81. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  82. //
  83. }
  84. /// <summary>
  85. /// 清理所有正在使用的资源。
  86. /// </summary>
  87. protected override void Dispose( bool disposing)
  88. {
  89. FormMain.formMain.forms.Romove(this);
  90. if( disposing )
  91. {
  92. if(components != null)
  93. {
  94. components.Dispose();
  95. }
  96. }
  97. base.Dispose( disposing );
  98. }
  99. #region Windows 窗体设计器生成的代码
  100. /// <summary>
  101. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  102. /// 此方法的内容。
  103. /// </summary>
  104. private void InitializeComponent()
  105. {
  106. this.components = new System.ComponentModel.Container();
  107. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FormMsgMis));
  108. this.mainMenu1 = new System.Windows.Forms.MainMenu();
  109. this.menuItemFile = new System.Windows.Forms.MenuItem();
  110. this.menFileExport = new System.Windows.Forms.MenuItem();
  111. this.menuItem3 = new System.Windows.Forms.MenuItem();
  112. this.meuFileExit = new System.Windows.Forms.MenuItem();
  113. this.menuItemEdit = new System.Windows.Forms.MenuItem();
  114. this.menuItemEditFirst = new System.Windows.Forms.MenuItem();
  115. this.menuItemEditFUp = new System.Windows.Forms.MenuItem();
  116. this.menuItemEditDown = new System.Windows.Forms.MenuItem();
  117. this.menuItemEditLast = new System.Windows.Forms.MenuItem();
  118. this.menuItem4 = new System.Windows.Forms.MenuItem();
  119. this.menuItemEditDelRecord = new System.Windows.Forms.MenuItem();
  120. this.menuItem5 = new System.Windows.Forms.MenuItem();
  121. this.menuItemEditCopy = new System.Windows.Forms.MenuItem();
  122. this.menuItem7 = new System.Windows.Forms.MenuItem();
  123. this.menuItemEditSelectAll = new System.Windows.Forms.MenuItem();
  124. this.menuItemView = new System.Windows.Forms.MenuItem();
  125. this.menViewRefresh = new System.Windows.Forms.MenuItem();
  126. this.toolBar1 = new System.Windows.Forms.ToolBar();
  127. this.ButExit = new System.Windows.Forms.ToolBarButton();
  128. this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
  129. this.ButFirst = new System.Windows.Forms.ToolBarButton();
  130. this.ButUp = new System.Windows.Forms.ToolBarButton();
  131. this.ButDown = new System.Windows.Forms.ToolBarButton();
  132. this.ButLast = new System.Windows.Forms.ToolBarButton();
  133. this.toolBarButton2 = new System.Windows.Forms.ToolBarButton();
  134. this.ButDelRecord = new System.Windows.Forms.ToolBarButton();
  135. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  136. this.statusBar1 = new System.Windows.Forms.StatusBar();
  137. this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
  138. this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
  139. this.panel2 = new System.Windows.Forms.Panel();
  140. this.panel1 = new System.Windows.Forms.Panel();
  141. this.panel3 = new System.Windows.Forms.Panel();
  142. this.panel4 = new System.Windows.Forms.Panel();
  143. this.TV_user = new System.Windows.Forms.TreeView();
  144. this.splitter1 = new System.Windows.Forms.Splitter();
  145. this.panel5 = new System.Windows.Forms.Panel();
  146. this.tabControl1 = new System.Windows.Forms.TabControl();
  147. this.tabPage1 = new System.Windows.Forms.TabPage();
  148. this.RTBRecord = new LanMsg.MyExtRichTextBox();
  149. this.contextMenu1 = new System.Windows.Forms.ContextMenu();
  150. this.menuItemCopy = new System.Windows.Forms.MenuItem();
  151. this.menuItem2 = new System.Windows.Forms.MenuItem();
  152. this.menuItemSelectAll = new System.Windows.Forms.MenuItem();
  153. this.tabPage2 = new System.Windows.Forms.TabPage();
  154. this.listView1 = new System.Windows.Forms.ListView();
  155. this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
  156. this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
  157. this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
  158. this.officeMenus1 = new LanMsg.Controls.OfficeMenus(this.components);
  159. ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
  160. ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
  161. this.panel5.SuspendLayout();
  162. this.tabControl1.SuspendLayout();
  163. this.tabPage1.SuspendLayout();
  164. this.tabPage2.SuspendLayout();
  165. this.SuspendLayout();
  166. // 
  167. // mainMenu1
  168. // 
  169. this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  170.   this.menuItemFile,
  171.   this.menuItemEdit,
  172.   this.menuItemView});
  173. // 
  174. // menuItemFile
  175. // 
  176. this.menuItemFile.Index = 0;
  177. this.menuItemFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  178.  this.menFileExport,
  179.  this.menuItem3,
  180.  this.meuFileExit});
  181. this.menuItemFile.Text = "文件(&F)";
  182. // 
  183. // menFileExport
  184. // 
  185. this.menFileExport.Index = 0;
  186. this.menFileExport.Text = "导出(&O)";
  187. this.menFileExport.Visible = false;
  188. // 
  189. // menuItem3
  190. // 
  191. this.menuItem3.Index = 1;
  192. this.menuItem3.OwnerDraw = true;
  193. this.menuItem3.Text = "-";
  194. this.menuItem3.Visible = false;
  195. // 
  196. // meuFileExit
  197. // 
  198. this.meuFileExit.Index = 2;
  199. this.meuFileExit.Text = "关闭(&E)";
  200. this.meuFileExit.Click += new System.EventHandler(this.meuFileExit_Click);
  201. // 
  202. // menuItemEdit
  203. // 
  204. this.menuItemEdit.Index = 1;
  205. this.menuItemEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  206.  this.menuItemEditFirst,
  207.  this.menuItemEditFUp,
  208.  this.menuItemEditDown,
  209.  this.menuItemEditLast,
  210.  this.menuItem4,
  211.  this.menuItemEditDelRecord,
  212.  this.menuItem5,
  213.  this.menuItemEditCopy,
  214.  this.menuItem7,
  215.  this.menuItemEditSelectAll});
  216. this.menuItemEdit.Text = "编辑(&E)";
  217. // 
  218. // menuItemEditFirst
  219. // 
  220. this.menuItemEditFirst.Enabled = false;
  221. this.menuItemEditFirst.Index = 0;
  222. this.menuItemEditFirst.Text = "第一页(&F)";
  223. this.menuItemEditFirst.Click += new System.EventHandler(this.menuItemEditFirst_Click);
  224. // 
  225. // menuItemEditFUp
  226. // 
  227. this.menuItemEditFUp.Enabled = false;
  228. this.menuItemEditFUp.Index = 1;
  229. this.menuItemEditFUp.Text = "上一页(&P)";
  230. this.menuItemEditFUp.Click += new System.EventHandler(this.menuItemEditFUp_Click);
  231. // 
  232. // menuItemEditDown
  233. // 
  234. this.menuItemEditDown.Enabled = false;
  235. this.menuItemEditDown.Index = 2;
  236. this.menuItemEditDown.Text = "下一页(N)";
  237. this.menuItemEditDown.Click += new System.EventHandler(this.menuItemEditDown_Click);
  238. // 
  239. // menuItemEditLast
  240. // 
  241. this.menuItemEditLast.Enabled = false;
  242. this.menuItemEditLast.Index = 3;
  243. this.menuItemEditLast.Text = "最后一页(L)";
  244. this.menuItemEditLast.Click += new System.EventHandler(this.menuItemEditLast_Click);
  245. // 
  246. // menuItem4
  247. // 
  248. this.menuItem4.Index = 4;
  249. this.menuItem4.Text = "-";
  250. // 
  251. // menuItemEditDelRecord
  252. // 
  253. this.menuItemEditDelRecord.Enabled = false;
  254. this.menuItemEditDelRecord.Index = 5;
  255. this.menuItemEditDelRecord.Shortcut = System.Windows.Forms.Shortcut.CtrlD;
  256. this.menuItemEditDelRecord.Text = "删除(&D)";
  257. this.menuItemEditDelRecord.Click += new System.EventHandler(this.menuItemEditDelRecord_Click);
  258. // 
  259. // menuItem5
  260. // 
  261. this.menuItem5.Index = 6;
  262. this.menuItem5.Text = "-";
  263. // 
  264. // menuItemEditCopy
  265. // 
  266. this.menuItemEditCopy.Index = 7;
  267. this.menuItemEditCopy.Text = "复制(&C)";
  268. this.menuItemEditCopy.Click += new System.EventHandler(this.menuItemEditCopy_Click);
  269. // 
  270. // menuItem7
  271. // 
  272. this.menuItem7.Index = 8;
  273. this.menuItem7.Text = "-";
  274. // 
  275. // menuItemEditSelectAll
  276. // 
  277. this.menuItemEditSelectAll.Index = 9;
  278. this.menuItemEditSelectAll.Text = "全选(&A)";
  279. this.menuItemEditSelectAll.Click += new System.EventHandler(this.menuItemEditSelectAll_Click);
  280. // 
  281. // menuItemView
  282. // 
  283. this.menuItemView.Index = 2;
  284. this.menuItemView.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  285.  this.menViewRefresh});
  286. this.menuItemView.Text = "视图(&V)";
  287. this.menuItemView.Visible = false;
  288. // 
  289. // menViewRefresh
  290. // 
  291. this.menViewRefresh.Index = 0;
  292. this.menViewRefresh.Text = "刷新(&F)";
  293. // 
  294. // toolBar1
  295. // 
  296. this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
  297. this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
  298. this.ButExit,
  299. this.toolBarButton1,
  300. this.ButFirst,
  301. this.ButUp,
  302. this.ButDown,
  303. this.ButLast,
  304. this.toolBarButton2,
  305. this.ButDelRecord});
  306. this.toolBar1.DropDownArrows = true;
  307. this.toolBar1.ImageList = this.imageList1;
  308. this.toolBar1.Location = new System.Drawing.Point(0, 0);
  309. this.toolBar1.Name = "toolBar1";
  310. this.toolBar1.ShowToolTips = true;
  311. this.toolBar1.Size = new System.Drawing.Size(632, 28);
  312. this.toolBar1.TabIndex = 0;
  313. this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
  314. // 
  315. // ButExit
  316. // 
  317. this.ButExit.ImageIndex = 18;
  318. this.ButExit.ToolTipText = "关闭";
  319. // 
  320. // toolBarButton1
  321. // 
  322. this.toolBarButton1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
  323. // 
  324. // ButFirst
  325. // 
  326. this.ButFirst.Enabled = false;
  327. this.ButFirst.ImageIndex = 15;
  328. this.ButFirst.ToolTipText = "第一页";
  329. // 
  330. // ButUp
  331. // 
  332. this.ButUp.Enabled = false;
  333. this.ButUp.ImageIndex = 15;
  334. this.ButUp.ToolTipText = "上一页";
  335. // 
  336. // ButDown
  337. // 
  338. this.ButDown.Enabled = false;
  339. this.ButDown.ImageIndex = 14;
  340. this.ButDown.ToolTipText = "下一页";
  341. // 
  342. // ButLast
  343. // 
  344. this.ButLast.Enabled = false;
  345. this.ButLast.ImageIndex = 15;
  346. this.ButLast.ToolTipText = "最后一页";
  347. // 
  348. // toolBarButton2
  349. // 
  350. this.toolBarButton2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
  351. // 
  352. // ButDelRecord
  353. // 
  354. this.ButDelRecord.Enabled = false;
  355. this.ButDelRecord.ImageIndex = 19;
  356. this.ButDelRecord.ToolTipText = "删除记录";
  357. // 
  358. // imageList1
  359. // 
  360. this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
  361. this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
  362. this.imageList1.TransparentColor = System.Drawing.Color.White;
  363. // 
  364. // statusBar1
  365. // 
  366. this.statusBar1.Location = new System.Drawing.Point(0, 403);
  367. this.statusBar1.Name = "statusBar1";
  368. this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
  369.   this.statusBarPanel1,
  370.   this.statusBarPanel2});
  371. this.statusBar1.ShowPanels = true;
  372. this.statusBar1.Size = new System.Drawing.Size(632, 22);
  373. this.statusBar1.TabIndex = 1;
  374. // 
  375. // statusBarPanel1
  376. // 
  377. this.statusBarPanel1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
  378. this.statusBarPanel1.MinWidth = 300;
  379. this.statusBarPanel1.Width = 416;
  380. // 
  381. // statusBarPanel2
  382. // 
  383. this.statusBarPanel2.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents;
  384. this.statusBarPanel2.MinWidth = 200;
  385. this.statusBarPanel2.Width = 200;
  386. // 
  387. // panel2
  388. // 
  389. this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
  390. this.panel2.Location = new System.Drawing.Point(4, 28);
  391. this.panel2.Name = "panel2";
  392. this.panel2.Size = new System.Drawing.Size(628, 4);
  393. this.panel2.TabIndex = 4;
  394. // 
  395. // panel1
  396. // 
  397. this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
  398. this.panel1.Location = new System.Drawing.Point(0, 28);
  399. this.panel1.Name = "panel1";
  400. this.panel1.Size = new System.Drawing.Size(4, 375);
  401. this.panel1.TabIndex = 3;
  402. // 
  403. // panel3
  404. // 
  405. this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom;
  406. this.panel3.Location = new System.Drawing.Point(4, 399);
  407. this.panel3.Name = "panel3";
  408. this.panel3.Size = new System.Drawing.Size(628, 4);
  409. this.panel3.TabIndex = 5;
  410. // 
  411. // panel4
  412. // 
  413. this.panel4.Dock = System.Windows.Forms.DockStyle.Right;
  414. this.panel4.Location = new System.Drawing.Point(628, 32);
  415. this.panel4.Name = "panel4";
  416. this.panel4.Size = new System.Drawing.Size(4, 367);
  417. this.panel4.TabIndex = 6;
  418. // 
  419. // TV_user
  420. // 
  421. this.TV_user.Dock = System.Windows.Forms.DockStyle.Left;
  422. this.TV_user.ImageIndex = -1;
  423. this.TV_user.Location = new System.Drawing.Point(4, 32);
  424. this.TV_user.Name = "TV_user";
  425. this.TV_user.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
  426. new System.Windows.Forms.TreeNode("所有人员 ", new System.Windows.Forms.TreeNode[] {
  427.    new System.Windows.Forms.TreeNode("部门"),
  428.    new System.Windows.Forms.TreeNode("部门"),
  429.    new System.Windows.Forms.TreeNode("部门"),
  430.    new System.Windows.Forms.TreeNode("部门"),
  431.    new System.Windows.Forms.TreeNode("部门"),
  432.    new System.Windows.Forms.TreeNode("部门"),
  433.    new System.Windows.Forms.TreeNode("部门"),
  434.    new System.Windows.Forms.TreeNode("部门"),
  435.    new System.Windows.Forms.TreeNode("部门"),
  436.    new System.Windows.Forms.TreeNode("部门"),
  437.    new System.Windows.Forms.TreeNode("未知")}),
  438. new System.Windows.Forms.TreeNode("通知消息")});
  439. this.TV_user.SelectedImageIndex = -1;
  440. this.TV_user.Size = new System.Drawing.Size(148, 367);
  441. this.TV_user.TabIndex = 7;
  442. this.TV_user.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TV_user_AfterSelect);
  443. // 
  444. // splitter1
  445. // 
  446. this.splitter1.Location = new System.Drawing.Point(152, 32);
  447. this.splitter1.Name = "splitter1";
  448. this.splitter1.Size = new System.Drawing.Size(4, 367);
  449. this.splitter1.TabIndex = 8;
  450. this.splitter1.TabStop = false;
  451. // 
  452. // panel5
  453. // 
  454. this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
  455. this.panel5.Controls.Add(this.tabControl1);
  456. this.panel5.Dock = System.Windows.Forms.DockStyle.Fill;
  457. this.panel5.Location = new System.Drawing.Point(156, 32);
  458. this.panel5.Name = "panel5";
  459. this.panel5.Size = new System.Drawing.Size(472, 367);
  460. this.panel5.TabIndex = 9;
  461. // 
  462. // tabControl1
  463. // 
  464. this.tabControl1.Controls.Add(this.tabPage1);
  465. this.tabControl1.Controls.Add(this.tabPage2);
  466. this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
  467. this.tabControl1.Location = new System.Drawing.Point(0, 0);
  468. this.tabControl1.Name = "tabControl1";
  469. this.tabControl1.SelectedIndex = 0;
  470. this.tabControl1.Size = new System.Drawing.Size(468, 363);
  471. this.tabControl1.TabIndex = 10;
  472. // 
  473. // tabPage1
  474. // 
  475. this.tabPage1.Controls.Add(this.RTBRecord);
  476. this.tabPage1.Location = new System.Drawing.Point(4, 21);
  477. this.tabPage1.Name = "tabPage1";
  478. this.tabPage1.Size = new System.Drawing.Size(460, 338);
  479. this.tabPage1.TabIndex = 0;
  480. this.tabPage1.Text = "对话记录";
  481. // 
  482. // RTBRecord
  483. // 
  484. this.RTBRecord.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  485. this.RTBRecord.ContextMenu = this.contextMenu1;
  486. this.RTBRecord.Dock = System.Windows.Forms.DockStyle.Fill;
  487. this.RTBRecord.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
  488. this.RTBRecord.HiglightColor = LanMsg.RtfColor.White;
  489. this.RTBRecord.Location = new System.Drawing.Point(0, 0);
  490. this.RTBRecord.Name = "RTBRecord";
  491. this.RTBRecord.ReadOnly = true;
  492. this.RTBRecord.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
  493. this.RTBRecord.Size = new System.Drawing.Size(460, 338);
  494. this.RTBRecord.TabIndex = 45;
  495. this.RTBRecord.Text = "";
  496. this.RTBRecord.TextColor = LanMsg.RtfColor.Black;
  497. // 
  498. // contextMenu1
  499. // 
  500. this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
  501.  this.menuItemCopy,
  502.  this.menuItem2,
  503.  this.menuItemSelectAll});
  504. // 
  505. // menuItemCopy
  506. // 
  507. this.menuItemCopy.Index = 0;
  508. this.menuItemCopy.Text = "复制(&C)";
  509. this.menuItemCopy.Click += new System.EventHandler(this.menuItemCopy_Click);
  510. // 
  511. // menuItem2
  512. // 
  513. this.menuItem2.Index = 1;
  514. this.menuItem2.Text = "-";
  515. // 
  516. // menuItemSelectAll
  517. // 
  518. this.menuItemSelectAll.Index = 2;
  519. this.menuItemSelectAll.Text = "全选(&A)";
  520. this.menuItemSelectAll.Click += new System.EventHandler(this.menuItemSelectAll_Click);
  521. // 
  522. // tabPage2
  523. // 
  524. this.tabPage2.Controls.Add(this.listView1);
  525. this.tabPage2.Location = new System.Drawing.Point(4, 21);
  526. this.tabPage2.Name = "tabPage2";
  527. this.tabPage2.Size = new System.Drawing.Size(460, 338);
  528. this.tabPage2.TabIndex = 1;
  529. this.tabPage2.Text = "基本资料";
  530. this.tabPage2.Visible = false;
  531. // 
  532. // listView1
  533. // 
  534. this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
  535. this.columnHeader1,
  536. this.columnHeader2,
  537. this.columnHeader3});
  538. this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
  539. this.listView1.Location = new System.Drawing.Point(0, 0);
  540. this.listView1.Name = "listView1";
  541. this.listView1.Size = new System.Drawing.Size(460, 338);
  542. this.listView1.TabIndex = 11;
  543. this.listView1.View = System.Windows.Forms.View.Details;
  544. // 
  545. // columnHeader1
  546. // 
  547. this.columnHeader1.Text = "项目";
  548. this.columnHeader1.Width = 120;
  549. // 
  550. // columnHeader2
  551. // 
  552. this.columnHeader2.Text = "内容";
  553. this.columnHeader2.Width = 120;
  554. // 
  555. // columnHeader3
  556. // 
  557. this.columnHeader3.Text = "备注";
  558. this.columnHeader3.Width = 200;
  559. // 
  560. // officeMenus1
  561. // 
  562. this.officeMenus1.ImageList = null;
  563. // 
  564. // FormMsgMis
  565. // 
  566. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  567. this.ClientSize = new System.Drawing.Size(632, 425);
  568. this.Controls.Add(this.panel5);
  569. this.Controls.Add(this.splitter1);
  570. this.Controls.Add(this.TV_user);
  571. this.Controls.Add(this.panel4);
  572. this.Controls.Add(this.panel3);
  573. this.Controls.Add(this.panel2);
  574. this.Controls.Add(this.panel1);
  575. this.Controls.Add(this.statusBar1);
  576. this.Controls.Add(this.toolBar1);
  577. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  578. this.Menu = this.mainMenu1;
  579. this.Name = "FormMsgMis";
  580. this.Text = "信息管理器";
  581. this.Load += new System.EventHandler(this.FormMsgMis_Load);
  582. ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
  583. ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
  584. this.panel5.ResumeLayout(false);
  585. this.tabControl1.ResumeLayout(false);
  586. this.tabPage1.ResumeLayout(false);
  587. this.tabPage2.ResumeLayout(false);
  588. this.ResumeLayout(false);
  589. }
  590. #endregion
  591. private void meuFileExit_Click(object sender, System.EventArgs e)
  592. {
  593. this.Close();
  594. }
  595. private void FormMsgMis_Load(object sender, System.EventArgs e)
  596. {
  597. this.officeMenus1.Start(this);
  598. this.TV_user.ImageList=this.FormMain.formMain.imageList1;
  599. TvRefresh();
  600. }
  601.  
  602. private void TvRefresh()
  603. {
  604. foreach(LanMsg.ClassUserInfo userinfo in this.FormMain.formMain.MyUsers)
  605. {
  606. System.Windows.Forms.TreeNode Node=new TreeNode();
  607. Node=(userinfo.Node.Clone() as TreeNode);
  608. TV_user.Nodes[0].Nodes[userinfo.Dep].Nodes.Add(Node);
  609. Node.Parent.Tag=userinfo.DepInfo;
  610. Node.Parent.Text=userinfo.DepInfo +"("+Node.Parent.Nodes.Count+")";
  611. }
  612. }
  613. private void TV_user_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
  614. {
  615. this.RTBRecord.Clear();
  616. this.ButLast.Enabled=false;
  617. this.ButDown.Enabled=false;
  618. this.ButFirst.Enabled=false;
  619. this.ButUp.Enabled=false;
  620. this.ButDelRecord.Enabled=false;
  621.             
  622. this.menuItemEditFirst.Enabled=false;
  623. this.menuItemEditFUp.Enabled=false;
  624. this.menuItemEditDown.Enabled=false;
  625. this.menuItemEditLast.Enabled=false;
  626. this.menuItemEditDelRecord.Enabled=false;
  627. this.PageCount=0;
  628. this.CurrPage=0;
  629.             this.firstID =0;
  630. this.LastID=2147483647;
  631.             this.statusBar1.Panels[0].Text="正在查看对话记录";
  632. if(e.Node.Parent !=null && e.Node.Parent.Parent!=null)
  633. {
  634. LanMsg.ClassUserInfo userinfo=this.FormMain.formMain.findUser(e.Node.Tag.ToString());
  635. CurrUser=userinfo.ID;
  636. if(userinfo!=null)
  637. this.statusBar1.Panels[0].Text="查看与"+userinfo.DepInfo +" "+ userinfo.UserName +"("+userinfo.ID+") 的对话记录";
  638. else
  639.     this.statusBar1.Panels[0].Text="查看与("+e.Node.Tag.ToString()+")的对话记录";
  640. this.PageCount =GetPageCount(e.Node.Tag.ToString(),this.FormMain.formMain.selfInfo.ID,true);
  641. if(this.PageCount>0)
  642. DBRecordToRichTextBox(CurrUser,this.FormMain.formMain.selfInfo.ID,true,false,true,false);
  643. }
  644. else if(e.Node.Parent ==null && e.Node.Nodes.Count==0)
  645. {
  646.                 CurrUser=this.FormMain.formMain.selfInfo.ID;
  647. this.statusBar1.Panels[0].Text="查看所有通知消息记录";
  648. this.PageCount =GetPageCount(this.FormMain.formMain.selfInfo.ID,this.FormMain.formMain.selfInfo.ID,false);
  649. if(this.PageCount>0)
  650. DBRecordToRichTextBox(CurrUser,CurrUser,false,false,true,false);
  651. }
  652. this.statusBar1.Panels[1].Text="第"+this.CurrPage.ToString()+"页(共"+ this.PageCount.ToString() +"页)";
  653. }
  654. public void selectID(string ID)
  655. {
  656. if(ID=="")return;
  657. if(ID=="Notice")this.TV_user.SelectedNode=this.TV_user.Nodes[1];
  658. else
  659. {
  660.               for(int i=0;i<this.TV_user.Nodes[0].Nodes.Count ;i++)
  661.                 foreach(System.Windows.Forms.TreeNode node in TV_user.Nodes[0].Nodes[i].Nodes)
  662. if(node.Tag.ToString()==ID)
  663. {
  664. node.Parent.Expand();
  665. this.TV_user.SelectedNode=node;
  666.             return;
  667. }
  668. }
  669. }
  670. public int CurrPage=0;//当前浏览的页
  671. public int PageCount=0;//页的总数
  672. public int pageSize=20;//每一页显示的记录数
  673. public int firstID=0;
  674. public int LastID=2147483647;
  675.         public string CurrUser="";
  676.         
  677. private int GetPageCount(string userID,string MyID,bool IsNotNotice)//获得页数
  678. {
  679. string DBtable="Notice";
  680. string sql="select Null from ["+DBtable+"] where (sendID='"+ MyID +"' or ReceiveID='"+ MyID +"')";
  681. if(IsNotNotice)
  682. {
  683. DBtable="MsgRecord";
  684. sql="select Null from ["+DBtable+"] where (sendID='"+ userID +"' and ReceiveID='"+ MyID +"') or (sendID='"+ MyID +"' and ReceiveID='"+ userID +"')";
  685. }
  686. int rows=new ClassOptionData(new ClassFormMain().ConStr).ExSQLR(sql);
  687. int count=Convert.ToInt32(rows/this.pageSize);
  688. if((rows % this.pageSize)!=0)
  689.                count += 1;
  690. return count;
  691. }
  692.  
  693. private void DBRecordToRichTextBox(string userID,string MyID,bool IsNotNotice,bool IsDown,bool IsFirst,bool IsLast)
  694. {
  695. this.RTBRecord.Clear();
  696. string DBtable="Notice";
  697. string Qualification=" (sendID='"+ MyID +"' or ReceiveID='"+ MyID +"')";
  698. string sql="";
  699.             
  700.             
  701. if(IsNotNotice)
  702. {
  703. DBtable="MsgRecord";
  704. Qualification=" ((sendID='"+ userID +"' and ReceiveID='"+ MyID +"') or (sendID='"+ MyID +"' and ReceiveID='"+ userID +"'))";
  705. }
  706.            
  707. if(IsDown)
  708. {
  709. this.CurrPage++;
  710.                 sql="select top "+ this.pageSize.ToString() +" * from ["+DBtable+"] where "+Qualification+" and ID<"+ this.LastID.ToString() +"  ORDER BY ID DESC";
  711. }
  712. else
  713. {
  714. this.CurrPage--;
  715. sql="select * from ["+DBtable+"] where ID in(select top "+ this.pageSize.ToString() +" ID from ["+DBtable+"] where "+Qualification+" and ID>"+ this.firstID.ToString() +")  ORDER BY ID DESC";//+"  ORDER BY ID DESC";
  716. }
  717. if(IsFirst) 
  718. {
  719.     this.CurrPage=1;
  720. sql="select top "+ this.pageSize.ToString() +" * from ["+DBtable+"] where "+Qualification+" ORDER BY ID DESC";
  721. }
  722. if(IsLast)
  723. {
  724.     this.CurrPage=this.PageCount;
  725. int mod=this.PageCount % this.pageSize;
  726. if( mod!=0)
  727.   sql="select * from ["+DBtable+"] where ID in(select top "+ mod +" ID from ["+DBtable+"] where "+Qualification+") ORDER BY ID DESC";
  728. else
  729.                   sql="select * from ["+DBtable+"] where ID in(select top "+ this.pageSize.ToString() +" ID from ["+DBtable+"] where "+Qualification+"  ORDER BY ID DESC";
  730. }
  731. this.ButLast.Enabled=true;
  732. this.ButDown.Enabled=true;
  733. this.ButFirst.Enabled=true;
  734. this.ButUp.Enabled=true;
  735. this.ButDelRecord.Enabled=true;
  736. this.menuItemEditFirst.Enabled=true;
  737. this.menuItemEditFUp.Enabled=true;
  738. this.menuItemEditDown.Enabled=true;
  739. this.menuItemEditLast.Enabled=true;
  740.             this.menuItemEditDelRecord.Enabled=true;
  741. if(this.CurrPage==this.PageCount)
  742. {
  743.    this.ButLast.Enabled=false;
  744.    this.ButDown.Enabled=false;
  745. this.menuItemEditDown.Enabled=false;
  746. this.menuItemEditLast.Enabled=false;
  747. }
  748. if(this.CurrPage==1)
  749. {
  750.     this.ButFirst.Enabled=false;
  751. this.ButUp.Enabled=false;
  752. this.menuItemEditFirst.Enabled=false;
  753. this.menuItemEditFUp.Enabled=false;
  754. }
  755.             
  756. System.Data.OleDb.OleDbDataReader dr=new ClassOptionData(new ClassFormMain().ConStr ).ExSQLReDr(sql);
  757. LanMsg.ClassUserInfo sendUserInfo=this.FormMain.formMain.selfInfo ;
  758.         
  759. int i=0;
  760.             bool IsSend=false;//标识此消息是否是对方发送的
  761. if(dr!=null)
  762. {
  763. while(dr.Read())
  764. {
  765. if(i==0)
  766. this.firstID=Convert.ToInt32(dr["ID"]);
  767. i++;
  768. IsSend=false;//标识此消息否是对方发送的
  769. sendUserInfo=null;
  770. LanMsg.MyExtRichTextBox rich=new MyExtRichTextBox();
  771. rich.ForeColor=Color.Blue;
  772. sendUserInfo=this.FormMain.formMain.findUser(Convert.ToString(dr["sendID"]).Trim());
  773. if(sendUserInfo!=null && sendUserInfo.ID==userID)
  774. {
  775. rich.ForeColor=Color.Red;
  776. IsSend=true;//此消息为对方发送的
  777. }
  778. rich.AppendText(sendUserInfo.UserName  + "("+sendUserInfo.ID +")" + Convert.ToString(dr["msgDateTime"]));
  779. this.RTBRecord.AppendRtf(rich.Rtf);
  780. rich.Clear();
  781. rich.Dispose();
  782. this.RTBRecord.AppendTextAsRtf("    ");
  783. if(IsNotNotice)
  784. textMsgToRich(Convert.ToString(dr["msgContent"]),Convert.ToString(dr["imageInfo"]),IsSend);
  785. else
  786. this.RTBRecord.AppendText(Convert.ToString(dr["msgContent"])+"n");
  787. LastID=Convert.ToInt32(dr["ID"]);
  788. }
  789. dr.Close();
  790. }
  791. this.statusBar1.Panels[1].Text="第"+this.CurrPage.ToString()+"页(共"+ this.PageCount.ToString() +"页)";
  792. }
  793. private void textMsgToRich(string msgContent,string ImageInfo,bool IsSend)//添加文本消息与图片到richBox
  794. {
  795.             LanMsg.ClassTextMsg textMsg=new ClassTextMsg();
  796. textMsg.MsgContent=msgContent;
  797. textMsg.ImageInfo=ImageInfo;
  798. if(textMsg.ImageInfo!="")//如果消息中有图片,则添加图片
  799. {
  800. string[] imagePos=textMsg.ImageInfo.Split('|');
  801. int addPos=0;//
  802. int currPos=0;//当前正要添加的文本位置
  803. int textPos=0;
  804. for(int i=0;i<imagePos.Length-1;i++)
  805. {
  806. string[] imageContent=imagePos[i].Split(',');//获得图片所在的位置、图片名称、图片宽、高
  807. currPos=Convert.ToInt32(imageContent[0]);
  808. this.RTBRecord.AppendText(textMsg.MsgContent.Substring(textPos,currPos-addPos));
  809. this.RTBRecord.SelectionStart=this.RTBRecord.TextLength;
  810. textPos += currPos-addPos ;
  811. addPos += currPos-addPos;
  812. System.Drawing.Image image=System.Drawing.Image.FromStream(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("LanMsg.Resources.ErrorImage.GIF")) ; 
  813. // LanMsg.MyPicture pic=new MyPicture();
  814. // pic.BackColor=this.RTBRecord.BackColor;
  815. // pic.SizeMode=System.Windows.Forms.PictureBoxSizeMode.AutoSize; 
  816. if(Convert.ToUInt32(imageContent[1])<96)
  817. // pic.Image=System.Drawing.Image.FromStream(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("LanMsg.Resources."+ imageContent[1] +".gif")) ; 
  818.       image=System.Drawing.Image.FromStream(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("LanMsg.Resources."+ imageContent[1] +".gif")) ; 
  819. else
  820. {
  821.     if(IsSend && new System.IO.FileInfo(Application.StartupPath +"\ArrivalImage\"+ imageContent[1] +".gif").Exists)
  822.         image=System.Drawing.Image.FromFile(Application.StartupPath +"\ArrivalImage\"+ imageContent[1] +".gif");
  823. else if(!IsSend && new System.IO.FileInfo(Application.StartupPath +"\sendImage\"+ imageContent[1] +".gif").Exists)
  824.         image=System.Drawing.Image.FromFile(Application.StartupPath +"\sendImage\"+ imageContent[1] +".gif");
  825. // pic.Tag=imageContent[1];
  826. // pic.Image=System.Drawing.Image.FromStream(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("LanMsg.Resources.ErrorImage.GIF")) ;
  827. }
  828.                     this.RTBRecord.InsertImage(image);
  829. // this.RTBRecord.InsertMyControl(pic);
  830. addPos ++;
  831. }
  832. this.RTBRecord.AppendText(textMsg.MsgContent.Substring(textPos,textMsg.MsgContent.Length-textPos) +"n");
  833. }
  834. else//如果消息中没有图片,则直接添加消息文本
  835. {
  836. this.RTBRecord.AppendText(textMsg.MsgContent +"n");
  837. }
  838. }
  839. private void delRecord(bool IsNotNotice)
  840. {
  841. if(MessageBox.Show("确定要删除当前的所有对话记录吗?","提示",System.Windows.Forms.MessageBoxButtons.YesNoCancel,System.Windows.Forms.MessageBoxIcon.Question)!=System.Windows.Forms.DialogResult.Yes)return;
  842. string DBtable="Notice";
  843. if(IsNotNotice)
  844. {
  845. DBtable="MsgRecord";
  846. }
  847.             string sql="delete * from ["+DBtable+"] where (sendID='"+ this.CurrUser  +"' or ReceiveID='"+ this.CurrUser +"')";
  848.     new ClassOptionData(new ClassFormMain().ConStr).ExSQL(sql);
  849. this.RTBRecord.Clear();
  850. this.ButDelRecord.Enabled=false;
  851. }
  852. private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
  853. {
  854. bool t=true;
  855.             if(this.TV_user.Nodes[1].IsSelected )t=false;
  856. switch(e.Button.ToolTipText)
  857. {
  858. case "第一页":
  859. DBRecordToRichTextBox(this.CurrUser,this.FormMain.formMain.selfInfo.ID,t,false,true,false);
  860. break;
  861. case "上一页":
  862. DBRecordToRichTextBox(this.CurrUser,this.FormMain.formMain.selfInfo.ID,t,false,false,false);
  863. break;
  864. case "下一页":
  865. DBRecordToRichTextBox(this.CurrUser,this.FormMain.formMain.selfInfo.ID,t,true,false,false);
  866. break;
  867. case "最后一页":
  868. DBRecordToRichTextBox(this.CurrUser,this.FormMain.formMain.selfInfo.ID,t,false,false,true);
  869. break;
  870. case "关闭":
  871. this.Dispose();
  872. break;
  873. case "删除记录":
  874. delRecord(t);
  875. break;
  876. }
  877. }
  878. private void menuItemCopy_Click(object sender, System.EventArgs e)
  879. {
  880. this.RTBRecord.Copy();
  881. }
  882. private void menuItemSelectAll_Click(object sender, System.EventArgs e)
  883. {
  884. this.RTBRecord.SelectAll();
  885. }
  886. private void menuItemEditCopy_Click(object sender, System.EventArgs e)
  887. {
  888.   this.RTBRecord.Copy();
  889. }
  890. private void menuItemEditSelectAll_Click(object sender, System.EventArgs e)
  891. {
  892.    this.RTBRecord.Focus();
  893.   this.RTBRecord.SelectAll();
  894. }
  895. private void menuItemEditFirst_Click(object sender, System.EventArgs e)
  896. {
  897. bool t=true;
  898. if(this.TV_user.Nodes[1].IsSelected )t=false;
  899. DBRecordToRichTextBox(this.CurrUser,this.FormMain.formMain.selfInfo.ID,t,false,true,false);
  900. }
  901. private void menuItemEditFUp_Click(object sender, System.EventArgs e)
  902. {
  903. bool t=true;
  904. if(this.TV_user.Nodes[1].IsSelected )t=false;
  905. DBRecordToRichTextBox(this.CurrUser,this.FormMain.formMain.selfInfo.ID,t,false,false,false);
  906. }
  907. private void menuItemEditDown_Click(object sender, System.EventArgs e)
  908. {
  909. bool t=true;
  910. if(this.TV_user.Nodes[1].IsSelected )t=false;
  911. DBRecordToRichTextBox(this.CurrUser,this.FormMain.formMain.selfInfo.ID,t,true,false,false);
  912. }
  913. private void menuItemEditLast_Click(object sender, System.EventArgs e)
  914. {
  915. bool t=true;
  916. if(this.TV_user.Nodes[1].IsSelected )t=false;
  917. DBRecordToRichTextBox(this.CurrUser,this.FormMain.formMain.selfInfo.ID,t,false,false,true);
  918. }
  919. private void menuItemEditDelRecord_Click(object sender, System.EventArgs e)
  920. {
  921. bool t=true;
  922. if(this.TV_user.Nodes[1].IsSelected )t=false;
  923. delRecord(t);
  924. }
  925. }
  926. }