Ejemplo n.º 1
0
 private void tabMain_MouseClick(object sender, MouseEventArgs e)
 {
     //退出当前页
     for (int i = 0; i < this.tabMain.TabPages.Count; i++)
     {
         Rectangle r           = tabMain.GetTabRect(i);
         Rectangle closeButton = new Rectangle(r.Right - 15, r.Top + 2, 13, 13);
         if (closeButton.Contains(e.Location))
         {
             if (this.tabMain.TabPages[i].Text.Trim() == "查询")
             {
                 //获取查询窗体
                 Control   control = tabMain.TabPages[i].Controls[0];
                 QueryForm qf      = (QueryForm)control;
                 if (qf.getSqlContext().Trim() != "")
                 {
                     DialogResult dr = MsgBox.ShowQuestion("是否保存当前文件?");
                     if (dr == DialogResult.OK)
                     {
                         new QueryForm().btnSaveFile_Click(sender, e);
                     }
                 }
             }
             this.tabMain.TabPages.RemoveAt(i);
             if (i > 0)
             {
                 this.tabMain.SelectedTab = this.tabMain.TabPages[i - 1];
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void MenuItem_select_Click(object sender, EventArgs e)
 {
     if (tvNav.SelectedNode != null)
     {
         if (tvNav.SelectedNode.Level == 0 || tvNav.SelectedNode.Parent.Text != "系统表")
         {
             MsgBox.ShowError("请选择要查询的系统表!");
             return;
         }
         QueryForm form      = new QueryForm();
         string    tableName = tvNav.SelectedNode.Text;
         form.sql = "select * from " + tableName + " limit 1000";
         ShowFormToTab("查询   ", form);
         form.setSqlContext(form.sql);
         form.sqlExecute(form.sql);
     }
     else
     {
         MsgBox.ShowError("请选择要查询的系统表!");
     }
 }