コード例 #1
0
 //禁止菜单ToolWindow ToolTabStrip的上下文菜单 隐藏Mdi窗体标题部分右键菜单
 /// <summary>
 /// 禁止菜单ToolWindow ToolTabStrip的上下文菜单 隐藏Mdi窗体标题部分右键菜单
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void MenuServiceContextMenuDisplaying(object sender, ContextMenuDisplayingEventArgs e)
 {
     //判断是不是DockWindow
     if (e.MenuType != ContextMenuType.DockWindow)
     {
         return;
     }
     //判断是不是DockWindow的ToolTabStrip
     if (e.DockWindow.DockTabStrip is ToolTabStrip)
     {
         //移除所有菜单
         e.Cancel = true;
         return;
     }
     //判断是不是DockWindow的DocumentTabStrip
     if (!(e.DockWindow.DockTabStrip is DocumentTabStrip))
     {
         return;
     }
     //移除“新建水平选项卡组”“新建垂直选项卡组”
     for (var i = 0; i < e.MenuItems.Count; i++)
     {
         var menuItem = e.MenuItems[i];
         if (menuItem.Name != "CloseWindow" &&
             menuItem.Name != "CloseAllButThis" &&
             menuItem.Name != "CloseAll")
         {
             menuItem.Visibility = ElementVisibility.Collapsed;
         }
     }
 }
コード例 #2
0
 /*
  * public void UpdateDataManager()
  * {
  *  try
  *  {
  *      List<SymbolGroup> newPortfolio = new List<SymbolGroup>();
  *
  *      foreach (DocumentWindow dw in radDock1.GetWindows<DocumentWindow>())
  *      {
  *          SymbolGroup nPortfolio = new SymbolGroup();
  *
  *          if (dw == documentWindow1)
  *              continue;
  *
  *          nPortfolio.Name = dw.Text;
  *          List<string> Symbols = new List<string>();
  *
  *          foreach (string s in from DataManagerExtends dm in dw.Controls from s in dm.AssetList select s)
  *          {
  *              Symbols.Add(s);
  *          }
  *          nPortfolio.Symbols = Symbols.ToArray();
  *          newPortfolio.Add(nPortfolio);
  *      }
  *
  *      //ListPortfolios.Instance().UpdatePortfolios(newPortfolio);
  *      DBSymbolShared.Connect();
  *      DBSymbolShared.SaveGroups(newPortfolio);
  *      DBSymbolShared.Disconnect();
  *
  *      MFrmMain.ReloadSelectTools();
  *  }
  *  catch (Exception ex)
  *  {
  *      MessageBox.Show(ex.Message);
  *  }
  * }
  */
 private void MenuServiceContextMenuDisplaying(object sender, ContextMenuDisplayingEventArgs e)
 {
     if (e.MenuType != ContextMenuType.ActiveWindowList)
     {
         e.Cancel = true;
     }
 }
コード例 #3
0
 private void menuService_ContextMenuDisplaying(object sender, ContextMenuDisplayingEventArgs e)
 {
     //the menu request is associated with a valid DockWindow instance, which resides within a DocumentTabStrip
     if (e.MenuType == ContextMenuType.DockWindow &&
         e.DockWindow.DockTabStrip is DocumentTabStrip)
     {
         //remove the "Close" menu items
         foreach (RadMenuItemBase menuItem in e.MenuItems)
         {
             if (menuItem.Name == "CloseWindow" ||
                 menuItem.Name == "CloseAllButThis" ||
                 menuItem.Name == "CloseAll" ||
                 menuItem is RadMenuSeparatorItem)
             {
                 // In case you just want to disable to option you can set Enabled false
                 // menuItem.Enabled = false;
                 menuItem.Text = "سلام";
                 // menuItem.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
             }
         }
     }
 }
コード例 #4
0
ファイル: _RadDock.cs プロジェクト: brillyints/sharpAHK_Dev
            /// <summary>
            /// Modify Dock Context Menu
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            private void menuService_ContextMenuDisplaying(object sender, ContextMenuDisplayingEventArgs e)
            {
                //the menu request is associated with a valid DockWindow instance, which resides within a DocumentTabStrip
                if (e.MenuType == ContextMenuType.DockWindow &&
                    e.DockWindow.DockTabStrip is DocumentTabStrip)
                {
                    //remove the "Close" menu items
                    for (int i = 0; i < e.MenuItems.Count; i++)
                    {
                        RadMenuItemBase menuItem = e.MenuItems[i];
                        if (menuItem.Name == "CloseWindow" ||
                            menuItem.Name == "CloseAllButThis" ||
                            menuItem.Name == "CloseAll" ||
                            menuItem is RadMenuSeparatorItem)
                        {
                            // In case you just want to disable to option you can set Enabled false
                            //menuItem.Enabled = false;
                            menuItem.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
                        }
                    }
                }

                // MENU ITEM'S NAMES

                //Text                        Name
                //---------------------------------------------------
                //Close                       CloseWindow
                //Close All But This          CloseAllButThis
                //Close All                   CloseAll
                //New Horizontal Tab Group    NewHTabGroup
                //New Vertical Tab Group      NewVTabGroup
                //Floating                    Floating
                //Dockable                    Docked
                //Tabbed Document             TabbedDocument
                //Auto Hide                   AutoHide
                //Hide                        Hidden
                //Document Name               ActivateWindow
            }
コード例 #5
0
ファイル: FrmMainClient.cs プロジェクト: LovingYao/myProgram
 //禁止菜单ToolWindow ToolTabStrip的上下文菜单 隐藏Mdi窗体标题部分右键菜单
 /// <summary>
 /// 禁止菜单ToolWindow ToolTabStrip的上下文菜单 隐藏Mdi窗体标题部分右键菜单
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void MenuServiceContextMenuDisplaying(object sender, ContextMenuDisplayingEventArgs e)
 {
     //判断是不是DockWindow
     if (e.MenuType != ContextMenuType.DockWindow)
         return;
     //判断是不是DockWindow的ToolTabStrip
     if (e.DockWindow.DockTabStrip is ToolTabStrip)
     {
         //移除所有菜单
         e.Cancel = true;
         return;
     }
     //判断是不是DockWindow的DocumentTabStrip
     if (!(e.DockWindow.DockTabStrip is DocumentTabStrip))
         return;
     //移除“新建水平选项卡组”“新建垂直选项卡组”
     for (var i = 0; i < e.MenuItems.Count; i++)
     {
         var menuItem = e.MenuItems[i];
         if (menuItem.Name != "CloseWindow" &&
             menuItem.Name != "CloseAllButThis" &&
             menuItem.Name != "CloseAll")
         {
             menuItem.Visibility = ElementVisibility.Collapsed;
         }
     }
 }