Ejemplo n.º 1
0
 /// <summary>
 /// 删除某个子窗体
 /// </summary>
 /// <param name="gui"></param>
 public void Remove(IMdiChild gui)
 {
     if (_hash.ContainsValue(gui))
     {
         Framework.WinGui.Menus.AppMenuCommand stype;
         if (this._active == gui)
         {
             this.DeactiveGui();
         }
         _hash.Remove(gui.ID);
         //移除工具条菜单
         Framework.WinGui.Menus.AppMenuCommand toollistmenu = AppMenuCommand.ToolBarList;
         if (toollistmenu != null)
         {
             if (gui.Tools != null)
             {
                 for (int i = 0; i < gui.Tools.Length; i++)
                 {
                     for (int j = 0; j < toollistmenu.Parent.MenuItems.Count; j++)
                     {
                         if (toollistmenu.Parent.MenuItems[j] is AppMenuCommand)
                         {
                             stype = (AppMenuCommand)toollistmenu.Parent.MenuItems[j];
                             if (stype.ID == gui.ID + gui.Tools[i].Name)
                             {
                                 toollistmenu.Parent.MenuItems.RemoveAt(j);
                                 break;
                             }
                         }
                     }
                 }
             }
         }
         //移除窗口菜单
         Framework.WinGui.Menus.AppMenuCommand mdilist = AppMenuCommand.MidList;
         if (mdilist != null)
         {
             for (int j = 0; j < mdilist.Parent.MenuItems.Count; j++)
             {
                 if (mdilist.Parent.MenuItems[j] is AppMenuCommand)
                 {
                     stype = (AppMenuCommand)mdilist.Parent.MenuItems[j];
                     if (stype.ID == gui.ID + "_MdiList")
                     {
                         mdilist.Parent.MenuItems.RemoveAt(j);
                         break;
                     }
                 }
             }
         }
         //释放窗体资源
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 添加子窗体至主父窗体中
 /// </summary>
 /// <param name="gui"></param>
 public void Add(IMdiChild gui)
 {
     if (this._hash.ContainsKey(gui.ID))
     {
         return;
     }
     else
     {
         this._hash.Add(gui.ID, gui);
         //添加工具条菜单
         Framework.WinGui.Menus.AppMenuCommand toollistmenu = AppMenuCommand.ToolBarList;
         if (toollistmenu != null)
         {
             if (gui.Tools != null && gui.Tools.Length != 0)
             {
                 for (int i = 0; i < gui.Tools.Length; i++)
                 {
                     Framework.WinGui.Menus.AppMenuCommand stype;
                     stype      = new AppMenuCommand(gui.ID + gui.Tools[i].Name, new ExecuteCommandHandler(this.OnMdiToolsBarSelectExecute), gui.Tools[i].Name);
                     stype.Text = gui.Tools[i].Text;
                     //默认为选择
                     stype.Checked        = true;
                     gui.Tools[i].Closed += new EventHandler(OnToolsBarClose);
                     toollistmenu.Parent.MenuItems.Add(stype);
                 }
             }
         }
         //添加窗体菜单
         Framework.WinGui.Menus.AppMenuCommand mdilist = AppMenuCommand.MidList;
         if (mdilist != null)
         {
             Framework.WinGui.Menus.AppMenuCommand stype;
             stype = new AppMenuCommand(gui.ID + "_MdiList", new ExecuteCommandHandler(this.OnMdiChildSelectExecute), gui.Caption);
             if (this._hash.Count == 1)
             {
                 stype.BeginGroup = true;
             }
             mdilist.Parent.MenuItems.Add(stype);
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void OnToolsBarClose(object sender, System.EventArgs e)
 {
     //添加工具条菜单
     Framework.WinGui.Menus.AppMenuCommand stype;
     Framework.WinGui.Menus.AppMenuCommand toollistmenu = AppMenuCommand.ToolBarList;
     if (toollistmenu != null && sender is TD.SandBar.ToolBar)
     {
         for (int j = 0; j < toollistmenu.Parent.MenuItems.Count; j++)
         {
             if (toollistmenu.Parent.MenuItems[j] is AppMenuCommand)
             {
                 stype = (AppMenuCommand)toollistmenu.Parent.MenuItems[j];
                 if (stype.ID == _active.ID + ((TD.SandBar.ToolBar)sender).Name)
                 {
                     stype.Checked = false;
                     break;
                 }
             }
         }
     }
 }