private void InitEvents() { this.pbDeviceManager.Click += new EventHandler((a, b) => { try { //先判断容器中有没有device manager if (pnContainer.Controls.Contains(viewManager)) { return; } if (pnContainer.Controls.Contains(dataManager)) { if (DialogResult.Cancel == dataManager.DeviceManagerExitDialog()) { return; } } AddDeviceManagerPanel(); SetDeviceClickPic((PictureBox)a); } catch { } }); this.pbAuditTrail.Click += new EventHandler((a, b) => { try { //先判断容器中有没有audit Trail if (pnContainer.Controls.Contains(auditTrail)) { return; } if (pnContainer.Controls.Contains(dataManager)) { if (DialogResult.Cancel == dataManager.DeviceManagerExitDialog()) { return; } } if (pnContainer.Controls.Contains(viewManager)) { if (DialogResult.Cancel == viewManager.DeviceManagerExitDialog()) { return; } } auditTrail.RefreshAuditTrail(); AddAuditTrail(); SetDeviceClickPic((PictureBox)a); } catch { } }); this.pbDataBase.Click += new EventHandler(ShowDataBase); //保存tps this.saveToolStripMenuItem.Click += new EventHandler((sender, args) => { if (pnContainer.Contains(viewManager)) { //viewManager.ExportTps("tps"); viewManager.Save(); } else { //dataManager.ExportTps(); dataManager.Save(); } }); this.openToolStripMenuItem.Click += new EventHandler(OpenTPSFile); //关闭窗口 this.exitToolStripMenuItem.Click += new EventHandler((sender, args) => this.form.Close()); //导出files this.tpsToolStripMenuItem.Click += new EventHandler((sender, args) => ExportTPS()); this.pDFToolStripMenuItem.Click += new EventHandler((sender, args) => ExportPDF()); this.excelToolStripMenuItem.Click += new EventHandler((sender, args) => ExportExcel()); this.emailFilesToolStripMenuItem.Click += new EventHandler((sender, args) => Email()); this.printFileToolStripMenuItem.Click += new EventHandler((sender, args) => Print(false)); this.printPreviewToolStripMenuItem.Click += new EventHandler((sender, args) => Print(true)); this.pbMail.Click += new EventHandler((sender, args) => Email()); //this.pbPrint.Click += new EventHandler((sender, args) =>Print()); this.viewManager.PbMax.Click += new EventHandler((a, b) => { if (form.FormBorderStyle == FormBorderStyle.Sizable) { ShowFullScreen(true); } else { UndoShowFullScreen(true); } }); this.dataManager.PbMax.Click += new EventHandler((a, b) => { if (form.FormBorderStyle == FormBorderStyle.Sizable) { ShowFullScreen(false); } else { UndoShowFullScreen(false); } }); #region 图片hover //pbDeviceManager.MouseHover += new EventHandler((sender, args) => //{ // if (!pnContainer.Controls.Contains(viewManager)) // { // pbDeviceManager.Image = Properties.Resources.tb_DM_h; // pbDeviceManager.Refresh(); // } //}); //pbDataBase.MouseHover += new EventHandler((sender, args) => //{ // if (pnContainer.Controls.Contains(dataManager)) // return; // pbDataBase.Image = Properties.Resources.tb_DB_h; //}); //pbAuditTrail.MouseHover += new EventHandler((sender, args) => //{ // if (pnContainer.Controls.Contains(auditTrail)) // return; // pbAuditTrail.Image = Properties.Resources.tb_audit_h; //}); pbExport.MouseHover += new EventHandler((sender, args) => { pbExport.Image = Properties.Resources.tb_export_s; }); pbMail.MouseHover += new EventHandler((sender, args) => { pbMail.Image = Properties.Resources.tb_mail_s; }); pbPrint.MouseHover += new EventHandler((sender, args) => { pbPrint.Image = Properties.Resources.tb_print_s; }); pbUpdate.MouseHover += new EventHandler((sender, args) => { pbUpdate.Image = Properties.Resources.tb_update_s; }); pbAdministration.MouseHover += new EventHandler((sender, args) => { pbAdministration.Image = Properties.Resources.tb_admin_s; }); #endregion #region 图片leave pbExport.MouseLeave += new EventHandler((sender, args) => { pbExport.Image = Properties.Resources.tb_export; }); pbMail.MouseLeave += new EventHandler((sender, args) => { pbMail.Image = Properties.Resources.tb_mail; }); pbPrint.MouseLeave += new EventHandler((sender, args) => { pbPrint.Image = Properties.Resources.Print; }); pbUpdate.MouseLeave += new EventHandler((sender, args) => { pbUpdate.Image = Properties.Resources.tb_update; }); pbAdministration.MouseLeave += new EventHandler((sender, args) => { pbAdministration.Image = Properties.Resources.tb_admin; }); //pbDeviceManager.MouseLeave += new EventHandler((sender, args) => //{ // if (pnContainer.Controls.Contains(viewManager)) // return; // pbDeviceManager.Image = Properties.Resources.tb_DM; //}); //pbDataBase.MouseLeave += new EventHandler((sender, args) => //{ // if (pnContainer.Controls.Contains(dataManager)) // return; // pbDataBase.Image = Properties.Resources.tb_DB; //}); //pbAuditTrail.MouseLeave += new EventHandler((sender, args) => //{ // if (pnContainer.Controls.Contains(auditTrail)) // return; // pbAuditTrail.Image = Properties.Resources.tb_audit; //}); #endregion form.SizeChanged += new EventHandler((sender, args) => { Size emptySize = new Size(1, 0); form.SuspendLayout(); if (isFullScreen == false) { if (isMinimum && (pnContainer.Size.Width > _PnContainerSize.Width || pnContainer.Size.Height > _PnContainerSize.Height)) { pnContainer.Size = _PnContainerSize; isMinimum = false; } else if (pnContainer.Size != emptySize) { _PnContainerSize = pnContainer.Size; isMinimum = false; } else if (pnContainer.Size == emptySize) { isMinimum = true; } else { isMinimum = false; } } pnContainer.Refresh(); form.ResumeLayout(false); }); //form.Resize += new EventHandler(ResizeEnd); if (this.dataManager != null) { this.dataManager.OnComapreStatusChange += new EventHandler((sender, e) => { this.checkCompareStatusAndSetExportMenuItems(sender); }); } //form.FormClosing += new FormClosingEventHandler(FormClosing); this.pbDeviceManager.MouseClick += new MouseEventHandler((sender, e) => { this.checkCompareStatusAndSetExportMenuItems(sender); }); this.pbDataBase.MouseClick += new MouseEventHandler((sender, e) => { this.checkCompareStatusAndSetExportMenuItems(sender); }); this.pbAuditTrail.MouseClick += new MouseEventHandler((sender, e) => { this.checkCompareStatusAndSetExportMenuItems(sender); }); }