| using System; | 
| using System.Collections.Generic; | 
| using System.ComponentModel; | 
| using System.Data; | 
| using System.Drawing; | 
| using System.Text; | 
| using System.Windows.Forms; | 
| using System.Diagnostics; | 
| using BaseSet; | 
|   | 
| namespace LMES | 
| { | 
|     public partial class MDIMain : Form | 
|     { | 
|         //private int childFormNumber = 0; | 
|         public MDIMain() | 
|         { | 
|             InitializeComponent(); | 
|         } | 
|   | 
|         Frm_Show frmNav = new Frm_Show();  | 
|   | 
|         private void MDIMain_Load(object sender, EventArgs e) | 
|         { | 
|             tabControl1.TabPages.Clear(); | 
|             tabControl1.Visible = false; | 
|             // | 
|             frmNav.MdiParent = this; | 
|             frmNav.Text = "导航图"; | 
|             frmNav.Show(); | 
|             AddTabPage(frmNav); | 
|             frmNav.Visible = false; | 
|             frmNav.WindowState = FormWindowState.Maximized; | 
|             frmNav.Visible = true; | 
|             //  | 
|             // | 
|             tsDate.Text ="当前日期:"+ DateTime.Today.ToShortDateString(); | 
|             tsUser.Text = "当前操作员:" + DBUtility.ClsPub.CurUserName; | 
|             tsAccNo.Text = "当前帐套:" + DBUtility.ClsPub.AccName; | 
|             this.Text = DBUtility.ClsPub.HOrgName; | 
|         } | 
|   | 
|   | 
|         /// <summary> | 
|         /// 添加一个标签 | 
|         /// </summary> | 
|         /// <param name="frm"></param> | 
|         public void AddTabPage(Form frm) | 
|         { | 
|             TabPage tp = new TabPage(); | 
|             tp.Tag = frm; | 
|             tp.Text = frm.Text; | 
|             tabControl1.TabPages.Add(tp); | 
|             tabControl1.SelectedIndex = tabControl1.TabCount - 1; | 
|             if (!tabControl1.Visible) tabControl1.Visible = true; | 
|         } | 
|   | 
|   | 
|         /// <summary> | 
|         /// 删除一个标签 | 
|         /// </summary> | 
|         /// <param name="selectedIndex"></param> | 
|         private void CloseTabPage(int selectedIndex) | 
|         { | 
|             if ((tabControl1.TabPages[selectedIndex].Tag as Form).Text == "导航图") | 
|             { | 
|                 return; | 
|             } | 
|             (tabControl1.TabPages[selectedIndex].Tag as Form).Close(); | 
|             tabControl1.TabPages.RemoveAt(selectedIndex); | 
|             if (tabControl1.TabPages.Count == 0) tabControl1.Visible = false; | 
|         } | 
|   | 
|         private void buttonItem1_Click(object sender, EventArgs e) | 
|         { | 
|             //Rtp_GridViewReportDlg frm_Test = new Rtp_GridViewReportDlg(); | 
|             //frm_Test.MdiParent = this; | 
|             //frm_Test.Show(); | 
|         } | 
|   | 
|         private void sideBar1_Click(object sender, EventArgs e) | 
|         { | 
|   | 
|         } | 
|   | 
|         private void 系统功能ToolStripMenuItem_Click(object sender, EventArgs e) | 
|         { | 
|              | 
|         } | 
|   | 
|         private void 重新注册ToolStripMenuItem_Click(object sender, EventArgs e) | 
|         { | 
|             Application.Exit(); | 
|             System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location); | 
|         } | 
|   | 
|         private void 退出系统ToolStripMenuItem_Click(object sender, EventArgs e) | 
|         { | 
|             Application.Exit(); | 
|               | 
|         } | 
|   | 
|         private void 计算器ToolStripMenuItem_Click(object sender, EventArgs e) | 
|         { | 
|             Process p = new Process(); | 
|             p.StartInfo.FileName = System.Environment.CurrentDirectory + @"\CALC.EXE"; | 
|             p.Start(); | 
|         } | 
|   | 
|         private void 拷贝表格ToolStripMenuItem_Click(object sender, EventArgs e) | 
|         { | 
|             DBUtility.ClsPub.ForEachControl(ActiveMdiChild, true); | 
|         } | 
|   | 
|         private void 数据导出ToolStripMenuItem_Click(object sender, EventArgs e) | 
|         { | 
|             DBUtility.ClsPub.ForEachControl(ActiveMdiChild, false); | 
|         } | 
|   | 
|         private void toolStripMenuItem4_Click(object sender, EventArgs e) | 
|         { | 
|   | 
|         } | 
|   | 
|         private void 用户模块设置ToolStripMenuItem_Click(object sender, EventArgs e) | 
|         { | 
|             //Xt_UserFunc oFrm = new Xt_UserFunc(); | 
|             //oFrm.ShowDialog(); | 
|         } | 
|   | 
|         private void 切换主界面ToolStripMenuItem_Click(object sender, EventArgs e) | 
|         { | 
|             //if (frmNav.Visible == true) | 
|             //{ | 
|             //    frmNav.Visible = false; | 
|             //    frmNavOld.WindowState = FormWindowState.Maximized; | 
|             //    frmNavOld.Visible = true; | 
|             //} | 
|             //else | 
|             //{ | 
|             //    frmNavOld.Visible = false; | 
|             //    frmNav.WindowState = FormWindowState.Maximized; | 
|             //    frmNav.Visible = true; | 
|             //} | 
|         } | 
|   | 
|         private void toolStripMenuItem3_Click(object sender, EventArgs e) | 
|         { | 
|             BLL.AboutBox1 oFrm = new BLL.AboutBox1(); | 
|             oFrm.ShowDialog(); | 
|         } | 
|   | 
|         private void 主菜单设置ToolStripMenuItem_Click(object sender, EventArgs e) | 
|         { | 
|             Xt_MainMenuSet oXt_MainMenuSet = new Xt_MainMenuSet();  | 
|             oXt_MainMenuSet.ShowDialog(); | 
|         } | 
|   | 
|         private void 错误信息ToolStripMenuItem_Click(object sender, EventArgs e) | 
|         { | 
|             BLL.Frm_SQLInfo oSQLInfo = new BLL.Frm_SQLInfo(); | 
|             oSQLInfo.ShowDialog(); | 
|         } | 
|   | 
|         private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) | 
|         { | 
|             if (tabControl1.SelectedIndex > -1) | 
|                 (tabControl1.TabPages[tabControl1.SelectedIndex].Tag as Form).Focus(); | 
|   | 
|             for (int i = 0; i < tabControl1.TabCount; i++) | 
|             { | 
|                 if ((tabControl1.TabPages[i].Tag as Form).Visible == false) | 
|                 { | 
|                     CloseTabPage(i); | 
|                 } | 
|             } | 
|         } | 
|   | 
|         private void tabControl1_MouseDoubleClick(object sender, MouseEventArgs e) | 
|         { | 
|             if (e.Button == System.Windows.Forms.MouseButtons.Left) // 只有左键双击才响应关闭 | 
|                 CloseTabPage(tabControl1.SelectedIndex); | 
|         } | 
|   | 
|          | 
|     } | 
| } |