private void OnPanelCommandClicked(object sender, CommandEventArgs args) { NCommand comm = args.Command; INDockingPanel panel = comm.Properties.Tag as INDockingPanel; if (panel == null) { return; } if (comm.Checked) { panel.Close(); } else { panel.Display(); } }
protected void RecreateToolbar() { m_Manager.Commander = new NCustomChartCommander(); m_Manager.ToolbarsBuilder = new NCustomChartToolbarsBuilder(this); m_Manager.Recreate(); NRange range1 = new NRange(); range1.ID = NCustomChartCommander.m_CustomCommandRange1; range1.Name = "Custom Commands1"; m_Manager.Ranges.Add(range1); NRange range2 = new NRange(); range2.ID = NCustomChartCommander.m_CustomCommandRange1; range2.Name = "Custom Commands1"; m_Manager.Ranges.Add(range2); m_Manager.ChartControl = nChartControl1; // remove the palette button from he standard toolbar for (int i = m_Manager.Toolbars.Count - 1; i >= 0; i--) { NDockingToolbar toolbar = m_Manager.Toolbars[i]; if (toolbar.DefaultRangeID == (int)ChartCommandRange.Standard) { // if not removed check whether to remove command from it if (!ShowPaletteButtonCheckBox.Checked) { NCommand command = toolbar.Commands.GetCommandById((int)ChartCommand.ApplyStyleSheet); toolbar.Commands.Remove(command); } } } }
private void CreateMenuBar() { NMenuBar menu = new NMenuBar(); menu.Text = "Examples Main Menu"; //forbide toolbar permisiions menu.AllowReset = false; menu.AllowRename = false; menu.AllowHide = false; NCommand comm, comm1; //create the "File" command comm = new NCommand(); comm.Properties.Text = "&File"; menu.Commands.Add(comm); //create the "Exit" command comm1 = new NCommand(); comm1.Properties.ID = (int)NDiagramExamplesCommandIDs.Exit; comm1.Properties.Text = "E&xit"; comm.Commands.Add(comm1); //create the "View" command comm = new NCommand(); comm.Properties.Text = "&View"; //add the "View Navigation" command comm1 = new NCommand(); comm1.Properties.Text = "Navigation Tree"; comm1.Properties.ID = (int)NDiagramExamplesCommandIDs.View_NavigationTree; comm.Commands.Add(comm1); //add the "View Example TabControl" command comm1 = new NCommand(); comm1.Properties.Text = "Example TabControl"; comm1.Properties.ID = (int)NDiagramExamplesCommandIDs.View_ExampleTabControl; comm.Commands.Add(comm1); //add the "View Example CommandBars" command comm1 = new NCommand(); comm1.Properties.Text = "Example Command Bars"; comm1.Properties.ID = (int)NDiagramExamplesCommandIDs.View_ExampleCommandBars; comm.Commands.Add(comm1); menu.Commands.Add(comm); //create the "Palette" command comm = new NCommand(); comm.Properties.Text = "&Palette"; //add the color scheme context comm.Commands.Add(NCommand.FromContext(Contexts.ContextFromID((int)NDiagramExamplesCommandIDs.ColorScheme))); //add the style3d context comm.Commands.Add(NCommand.FromContext(Contexts.ContextFromID((int)NDiagramExamplesCommandIDs.Style3D))); //add the "Edit Palette" command comm1 = new NCommand(); comm1.Properties.BeginGroup = true; comm1.Properties.Text = "&Edit"; comm1.Properties.ID = (int)NDiagramExamplesCommandIDs.Palette_Edit; comm.Commands.Add(comm1); menu.Commands.Add(comm); //create the "File" command comm = new NCommand(); comm.Properties.Text = "&Help"; comm1 = new NCommand(); comm1.Properties.Text = "&About..."; comm.Commands.Add(comm1); menu.Commands.Add(comm); //add the menu to the toolbars collection base.Toolbars.Add(menu); }