static RibbonPanel AddOnePanel() { RibbonButton plotThisButton; RibbonPanelSource rps = new RibbonPanelSource(); rps.Title = "Plotting"; RibbonPanel rp = new RibbonPanel(); rp.Source = rps; //Create a Command Item that the Dialog Launcher can use, // for this test it is just a place holder. RibbonButton rci = new RibbonButton(); //rci.Name = "TestCommand"; //assign the Command Item to the DialgLauncher which auto-enables // the little button at the lower right of a Panel rps.DialogLauncher = rci; plotThisButton = new RibbonButton(); plotThisButton.Name = "Plot"; plotThisButton.ShowText = true; plotThisButton.Text = "Plot"; plotThisButton.CommandHandler = new MyRibbonCommandHandler(); plotThisButton.CommandParameter = "HelloWorld "; //Add the Button to the Tab rps.Items.Add(plotThisButton); return rp; }
public Form1() { InitializeComponent(); _buttonDropB = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDropB); _buttonDropB.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonDropB_ExecuteEvent); }
public Form1() { InitializeComponent(); _buttonDropA = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDropA); _spinner = new RibbonSpinner(_ribbon, (uint)RibbonMarkupCommands.cmdSpinner); _buttonDropA.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonDropA_ExecuteEvent); }
public Form1() { InitializeComponent(); _exitButton = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonExit); _helpButton = new RibbonHelpButton(_ribbon, (uint)RibbonMarkupCommands.cmdHelpButton); _exitButton.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_exitButton_ExecuteEvent); _helpButton.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_helpButton_ExecuteEvent); }
public Form1() { InitializeComponent(); _button = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButton); _toggleButton = new RibbonToggleButton(_ribbon, (uint)RibbonMarkupCommands.cmdToggleButton); _checkBox = new RibbonLib.Controls.RibbonCheckBox(_ribbon, (uint)RibbonMarkupCommands.cmdCheckBox); _button.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_button_ExecuteEvent); }
private void InitList() { Image[] images = new Image[50]; RibbonProfessionalRenderer rend = new RibbonProfessionalRenderer(); Random r = new Random(); using (GraphicsPath path = rend.RoundRectangle(new Rectangle(3, 3, 26, 26), 4)) { using (GraphicsPath outer = rend.RoundRectangle(new Rectangle(0,0,32,32), 4)) { for (int i = 0; i < images.Length; i++) { Bitmap b = new Bitmap(32, 32); using (Graphics g = Graphics.FromImage(b)) { g.SmoothingMode = SmoothingMode.AntiAlias; using (SolidBrush br = new SolidBrush(Color.FromKnownColor((KnownColor)r.Next(1, 150)))) { g.FillPath(br, path); } using (Pen p = new Pen(Color.White, 3)) { g.DrawPath(p, path); } g.DrawPath(Pens.Wheat, path); } images[i] = b; RibbonButton btn = new RibbonButton(); btn.Image = b; lst.Buttons.Add(btn); } } } //lst.DropDownItems.Add(new RibbonSeparator("Available styles")); RibbonButtonList lst2 = new RibbonButtonList(); for (int i = 0; i < images.Length; i++) { RibbonButton btn = new RibbonButton(); btn.Image = images[i]; lst2.Buttons.Add(btn); } lst.DropDownItems.Add(lst2); //lst.DropDownItems.Add(new RibbonSeparator("Style Options")); lst.DropDownItems.Add(new RibbonButton("Save style...")); lst.DropDownItems.Add(new RibbonButton("Create style")); lst.DropDownItems.Add(new RibbonButton("Apply style...")); }
public Form1() { InitializeComponent(); _groupButtons = new RibbonGroup(_ribbon, (uint)RibbonMarkupCommands.cmdButtonsGroup); _groupColors = new RibbonGroup(_ribbon, (uint)RibbonMarkupCommands.cmdDropDownColorPickerGroup); _buttonListColors = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonListColors); _themeColors = new RibbonDropDownColorPicker(_ribbon, (uint)RibbonMarkupCommands.cmdDropDownColorPickerThemeColors); _standardColors = new RibbonDropDownColorPicker(_ribbon, (uint)RibbonMarkupCommands.cmdDropDownColorPickerStandardColors); _highlightColors = new RibbonDropDownColorPicker(_ribbon, (uint)RibbonMarkupCommands.cmdDropDownColorPickerHighlightColors); _buttonListColors.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonListColors_ExecuteEvent); }
public Form1() { InitializeComponent(); _applicationMenu = new RibbonApplicationMenu(_ribbon, (uint)RibbonMarkupCommands.cmdApplicationMenu); _buttonNew = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonNew); _buttonOpen = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonOpen); _buttonSave = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonSave); _buttonExit = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonExit); _applicationMenu.TooltipTitle = "Menu"; _applicationMenu.TooltipDescription = "Application main menu"; _buttonNew.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonNew_ExecuteEvent); }
private void AddQuickAccessToolbarItem() { Autodesk.Windows.ToolBars.QuickAccessToolBarSource qat = ComponentManager.QuickAccessToolBar; if (qat != null) { // Create our Ribbon Button RibbonButton rb = new RibbonButton(); rb.Text = appText; rb.Description = appDesc; rb.Image = GetIcon(smallFile); // Attach the handler to fire out command rb.CommandHandler = new AutoCADCommandHandler(bpCmd); // Add it to the Quick Access Toolbar qat.AddStandardItem(rb); } }
internal RibbonQuickAccessToolbar(Controls.Ribbon.Ribbon ownerRibbon) { if (ownerRibbon == null) throw new ArgumentNullException("ownerRibbon"); SetOwner(ownerRibbon); _dropDownButton = new RibbonButton(); _dropDownButton.SetOwner(ownerRibbon); _dropDownButton.SmallImage = CreateDropDownButtonImage(); _margin = new Padding(9); _padding = new Padding(3, 0, 0, 0); _items = new RibbonQuickAccessToolbarItemCollection(this); _sensor = new RibbonSensor(ownerRibbon, ownerRibbon, Items); _DropDownButtonVisible = true; }
public void BuildRibbonTab(C1Ribbon c1Ribbon, IList<MenuDTO> mainMenu, Int32 defaultModuleId) { RibbonButton defaultModuleRibbonButton = null; RibbonTab ribbonTab = c1Ribbon.Tabs[0]; c1Ribbon.SelectedTab = ribbonTab; var modules = mainMenu.Where(x => x.Parent == null) .OrderBy(x => x.OrderId) .ToList(); MenuDTO defaultModule = modules.Where(x => x.Id == defaultModuleId).FirstOrDefault(); foreach(var module in modules) { RibbonGroup ribbonGroup = ribbonTab.Groups.Add(string.Empty); RibbonButton ribbonButton = new RibbonButton() { Name = module.Id.ToString(), Text = module.Name, LargeImage = GetImage(module.IconPath), TextImageRelation = TextImageRelation.ImageAboveText, Tag = module, }; ribbonButton.Click += new EventHandler(ribbonButton_ClickEventHandler); if (defaultModuleRibbonButton == null) { if (defaultModule == null) { defaultModuleRibbonButton = ribbonButton; } else if (module.Id == defaultModuleId) { defaultModuleRibbonButton = ribbonButton; } } ribbonGroup.Items.Add(ribbonButton); } ribbonButton_ClickEventHandler(defaultModuleRibbonButton, null); }
public Form1() { InitializeComponent(); _buttonNew = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonNew); _buttonOpen = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonOpen); _buttonSave = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonSave); _tabMain = new RibbonTab(_ribbon, (uint)RibbonMarkupCommands.cmdTabMain); _groupFileActions = new RibbonGroup(_ribbon, (uint)RibbonMarkupCommands.cmdGroupFileActions); _ribbonQuickAccessToolbar = new RibbonQuickAccessToolbar(_ribbon, (uint)RibbonMarkupCommands.cmdQAT, (uint)RibbonMarkupCommands.cmdCustomizeQAT); _buttonNew.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonNew_ExecuteEvent); _buttonSave.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonSave_ExecuteEvent); _buttonOpen.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonOpen_ExecuteEvent); // register to the QAT customize button _ribbonQuickAccessToolbar.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_ribbonQuickAccessToolbar_ExecuteEvent); }
public Form1() { InitializeComponent(); _tabMain = new RibbonTab(_ribbon, (uint)RibbonMarkupCommands.cmdTabMain); _groupCommon = new RibbonGroup(_ribbon, (uint)RibbonMarkupCommands.cmdGroupCommon); _groupSimple = new RibbonGroup(_ribbon, (uint)RibbonMarkupCommands.cmdGroupSimple); _groupAdvanced = new RibbonGroup(_ribbon, (uint)RibbonMarkupCommands.cmdGroupAdvanced); _buttonNew = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonNew); _buttonOpen = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonOpen); _buttonSave = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonSave); _buttonDropA = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDropA); _buttonDropB = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDropB); _buttonDropC = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDropC); _buttonSwitchToAdvanced = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonSwitchToAdvanced); _buttonSwitchToSimple = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonSwitchToSimple); _buttonSwitchToAdvanced.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonSwitchToAdvanced_ExecuteEvent); _buttonSwitchToSimple.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonSwitchToSimple_ExecuteEvent); }
public Form1() { InitializeComponent(); _tabMain = new RibbonTab(_ribbon, (uint)RibbonMarkupCommands.cmdTabMain); _groupMain = new RibbonGroup(_ribbon, (uint)RibbonMarkupCommands.cmdGroupMain); _tabGroupTableTools = new RibbonTabGroup(_ribbon, (uint)RibbonMarkupCommands.cmdTabGroupTableTools); _tabDesign = new RibbonTab(_ribbon, (uint)RibbonMarkupCommands.cmdTabDesign); _tabLayout = new RibbonTab(_ribbon, (uint)RibbonMarkupCommands.cmdTabLayout); _groupDesign = new RibbonGroup(_ribbon, (uint)RibbonMarkupCommands.cmdGroupDesign); _groupLayout = new RibbonGroup(_ribbon, (uint)RibbonMarkupCommands.cmdGroupLayout); _buttonSelect = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonSelect); _buttonUnselect = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonUnselect); _buttonDesign1 = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDesign1); _buttonDesign2 = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDesign2); _buttonDesign3 = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonDesign3); _buttonLayout1 = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonLayout1); _buttonLayout2 = new RibbonButton(_ribbon, (uint)RibbonMarkupCommands.cmdButtonLayout2); _buttonSelect.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonSelect_ExecuteEvent); _buttonUnselect.ExecuteEvent += new EventHandler<ExecuteEventArgs>(_buttonUnselect_ExecuteEvent); }
/// <summary> /// Sự kiện hot key /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tlbHotKey_Click(object sender, RoutedEventArgs e) { RibbonButton tlb = (RibbonButton)sender; string strTinhNang = tlb.Name.Substring(3, tlb.Name.Length - 3); if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.NHAP_DU_LIEU))) { } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.THEM))) { Them(); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.THUC_HIEN))) { Process(); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XOA))) { //Xoa(); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.NHAN_BAN))) { } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.LUU_TAM))) { //LuuDuLieu(BusinessConstant.TrangThaiBanGhi.SU_DUNG, BusinessConstant.TrangThaiNghiepVu.LUU_TAM, DatabaseConstant.Action.LUU_TAM); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TRINH_DUYET))) { //LuuDuLieu(BusinessConstant.TrangThaiBanGhi.SU_DUNG, BusinessConstant.TrangThaiNghiepVu.CHO_DUYET, DatabaseConstant.Action.TRINH_DUYET); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.BANG_KE))) { } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.DUYET))) { //Duyet(); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TU_CHOI_DUYET))) { //TuChoiDuyet(); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.THOAI_DUYET))) { //ThoaiDuyet(); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XEM_TRUOC))) { } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XEM))) { } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XUAT_DU_LIEU))) { } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TIM_KIEM))) { } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TRO_GIUP))) { onHelp(); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.DONG))) { CustomControl.CommonFunction.CloseUserControl(this); } }
private static void AddPanels(RibbonTab ribTab) { try { var confCuiXel = ModPlusAPI.RegistryData.Adaptation.GetCuiAsXElement("AutoCAD"); // Проходим по группам if (confCuiXel != null) { foreach (var group in confCuiXel.Elements("Group")) { if (group.Attribute("GroupName") == null) { continue; } // create the panel source var ribSourcePanel = new RibbonPanelSource { Title = Language.TryGetCuiLocalGroupName(group.Attribute("GroupName")?.Value) }; // now the panel var ribPanel = new RibbonPanel { Source = ribSourcePanel }; ribTab.Panels.Add(ribPanel); var ribRowPanel = new RibbonRowPanel(); // Вводим спец.счетчик, который потребуется для разбивки по строкам var nr = 0; var hasFunctions = false; // Если последняя функция в группе была 32х32 var lastWasBig = false; // Проходим по функциям группы foreach (var func in group.Elements("Function")) { var fNameAttr = func.Attribute("Name")?.Value; if (string.IsNullOrEmpty(fNameAttr)) { continue; } if (LoadFunctionsHelper.LoadedFunctions.Any(x => x.Name.Equals(fNameAttr))) { var loadedFunction = LoadFunctionsHelper.LoadedFunctions.FirstOrDefault(x => x.Name.Equals(fNameAttr)); if (loadedFunction == null) { continue; } hasFunctions = true; if (nr == 0) { ribRowPanel = new RibbonRowPanel(); } // В зависимости от размера var btnSizeAttr = func.Attribute("WH")?.Value; if (string.IsNullOrEmpty(btnSizeAttr)) { continue; } #region 16 if (btnSizeAttr.Equals("16")) { lastWasBig = false; // Если функция имеет "подфункции", то делаем SplitButton if (func.Elements("SubFunction").Any()) { // Создаем SplitButton var risSplitBtn = new RibbonSplitButton { Text = "RibbonSplitButton", Orientation = Orientation.Horizontal, Size = RibbonItemSize.Standard, ShowImage = true, ShowText = false, ListButtonStyle = Autodesk.Private.Windows.RibbonListButtonStyle.SplitButton, ResizeStyle = RibbonItemResizeStyles.NoResize, ListStyle = RibbonSplitButtonListStyle.List }; // Добавляем в него первую функцию, которую делаем основной var ribBtn = RibbonHelpers.AddButton( loadedFunction.Name, Language.GetFunctionLocalName(loadedFunction.Name, loadedFunction.LName), GetSmallIcon(loadedFunction), GetBigIcon(loadedFunction), Language.GetFunctionShortDescription(loadedFunction.Name, loadedFunction.Description), Orientation.Horizontal, Language.GetFunctionFullDescription(loadedFunction.Name, loadedFunction.FullDescription), loadedFunction.ToolTipHelpImage); risSplitBtn.Items.Add(ribBtn); risSplitBtn.Current = ribBtn; // Затем добавляем подфункции foreach (var subFunc in func.Elements("SubFunction")) { if (LoadFunctionsHelper.LoadedFunctions.Any(x => x.Name.Equals(subFunc.Attribute("Name")?.Value))) { var loadedSubFunction = LoadFunctionsHelper.LoadedFunctions .FirstOrDefault(x => x.Name.Equals(subFunc.Attribute("Name")?.Value)); if (loadedSubFunction == null) { continue; } risSplitBtn.Items.Add(RibbonHelpers.AddButton( loadedSubFunction.Name, Language.GetFunctionLocalName(loadedSubFunction.Name, loadedSubFunction.LName), GetSmallIcon(loadedSubFunction), GetBigIcon(loadedSubFunction), Language.GetFunctionShortDescription(loadedSubFunction.Name, loadedSubFunction.Description), Orientation.Horizontal, Language.GetFunctionFullDescription(loadedSubFunction.Name, loadedSubFunction.FullDescription), loadedSubFunction.ToolTipHelpImage)); } } ribRowPanel.Items.Add(risSplitBtn); } // Если в конфигурации меню не прописано наличие подфункций, то проверяем, что они могут быть в самой функции else if (loadedFunction.SubFunctionsNames.Any()) { // Создаем SplitButton var risSplitBtn = new RibbonSplitButton { Text = "RibbonSplitButton", Orientation = Orientation.Horizontal, Size = RibbonItemSize.Standard, ShowImage = true, ShowText = false, ListButtonStyle = Autodesk.Private.Windows.RibbonListButtonStyle.SplitButton, ResizeStyle = RibbonItemResizeStyles.NoResize, ListStyle = RibbonSplitButtonListStyle.List }; // Добавляем в него первую функцию, которую делаем основной var ribBtn = RibbonHelpers.AddButton( loadedFunction.Name, Language.GetFunctionLocalName(loadedFunction.Name, loadedFunction.LName), GetSmallIcon(loadedFunction), GetBigIcon(loadedFunction), Language.GetFunctionShortDescription(loadedFunction.Name, loadedFunction.Description), Orientation.Horizontal, Language.GetFunctionFullDescription(loadedFunction.Name, loadedFunction.FullDescription), loadedFunction.ToolTipHelpImage); risSplitBtn.Items.Add(ribBtn); risSplitBtn.Current = ribBtn; // Затем добавляем подфункции for (int i = 0; i < loadedFunction.SubFunctionsNames.Count; i++) { risSplitBtn.Items.Add(RibbonHelpers.AddButton( loadedFunction.SubFunctionsNames[i], Language.GetFunctionLocalName(loadedFunction.Name, loadedFunction.SubFunctionsLNames[i], i + 1), GetSmallIconForSubFunction(loadedFunction, i), GetBigIconForSubFunction(loadedFunction, i), Language.GetFunctionShortDescription(loadedFunction.Name, loadedFunction.SubDescriptions[i], i + 1), Orientation.Horizontal, Language.GetFunctionFullDescription(loadedFunction.Name, loadedFunction.SubFullDescriptions[i], i + 1), loadedFunction.SubHelpImages[i])); } ribRowPanel.Items.Add(risSplitBtn); } // Иначе просто добавляем маленькую кнопку else { ribRowPanel.Items.Add(RibbonHelpers.AddSmallButton( loadedFunction.Name, Language.GetFunctionLocalName(loadedFunction.Name, loadedFunction.LName), GetSmallIcon(loadedFunction), Language.GetFunctionShortDescription(loadedFunction.Name, loadedFunction.Description), Language.GetFunctionFullDescription(loadedFunction.Name, loadedFunction.FullDescription), loadedFunction.ToolTipHelpImage)); } nr++; if (nr == 3 | nr == 6) { ribRowPanel.Items.Add(new RibbonRowBreak()); } if (nr == 9) { ribSourcePanel.Items.Add(ribRowPanel); nr = 0; } } #endregion // Если кнопка большая, то добавляем ее в отдельную Row Panel #region 32 if (btnSizeAttr.Equals("32")) { lastWasBig = true; if (ribRowPanel.Items.Count > 0) { ribSourcePanel.Items.Add(ribRowPanel); nr = 0; } ribRowPanel = new RibbonRowPanel(); // Если функция имеет "подфункции", то делаем SplitButton if (func.Elements("SubFunction").Any()) { // Создаем SplitButton var risSplitBtn = new RibbonSplitButton { Text = "RibbonSplitButton", Orientation = Orientation.Vertical, Size = RibbonItemSize.Large, ShowImage = true, ShowText = true, ListButtonStyle = Autodesk.Private.Windows.RibbonListButtonStyle.SplitButton, ResizeStyle = RibbonItemResizeStyles.NoResize, ListStyle = RibbonSplitButtonListStyle.List }; // Добавляем в него первую функцию, которую делаем основной var ribBtn = RibbonHelpers.AddBigButton( loadedFunction.Name, Language.GetFunctionLocalName(loadedFunction.Name, loadedFunction.LName), GetBigIcon(loadedFunction), Language.GetFunctionShortDescription(loadedFunction.Name, loadedFunction.Description), Orientation.Horizontal, Language.GetFunctionFullDescription(loadedFunction.Name, loadedFunction.FullDescription), loadedFunction.ToolTipHelpImage); risSplitBtn.Items.Add(ribBtn); risSplitBtn.Current = ribBtn; // Затем добавляем подфункции foreach (var subFunc in func.Elements("SubFunction")) { if (LoadFunctionsHelper.LoadedFunctions.Any(x => x.Name.Equals(subFunc.Attribute("Name")?.Value))) { var loadedSubFunction = LoadFunctionsHelper.LoadedFunctions.FirstOrDefault(x => x.Name.Equals(subFunc.Attribute("Name")?.Value)); if (loadedSubFunction == null) { continue; } risSplitBtn.Items.Add(RibbonHelpers.AddBigButton( loadedSubFunction.Name, Language.GetFunctionLocalName(loadedSubFunction.Name, loadedSubFunction.LName), GetBigIcon(loadedSubFunction), Language.GetFunctionShortDescription(loadedSubFunction.Name, loadedSubFunction.Description), Orientation.Horizontal, Language.GetFunctionFullDescription(loadedSubFunction.Name, loadedSubFunction.FullDescription), loadedSubFunction.ToolTipHelpImage)); } } ribRowPanel.Items.Add(risSplitBtn); } // Если в конфигурации меню не прописано наличие подфункций, то проверяем, что они могут быть в самой функции else if (loadedFunction.SubFunctionsNames.Any()) { // Создаем SplitButton var risSplitBtn = new RibbonSplitButton { Text = "RibbonSplitButton", Orientation = Orientation.Vertical, Size = RibbonItemSize.Large, ShowImage = true, ShowText = true, ListButtonStyle = Autodesk.Private.Windows.RibbonListButtonStyle.SplitButton, ResizeStyle = RibbonItemResizeStyles.NoResize, ListStyle = RibbonSplitButtonListStyle.List }; // Добавляем в него первую функцию, которую делаем основной var ribBtn = RibbonHelpers.AddBigButton( loadedFunction.Name, Language.GetFunctionLocalName(loadedFunction.Name, loadedFunction.LName), GetBigIcon(loadedFunction), Language.GetFunctionShortDescription(loadedFunction.Name, loadedFunction.Description), Orientation.Horizontal, Language.GetFunctionFullDescription(loadedFunction.Name, loadedFunction.FullDescription), loadedFunction.ToolTipHelpImage); risSplitBtn.Items.Add(ribBtn); risSplitBtn.Current = ribBtn; // Затем добавляем подфункции for (int i = 0; i < loadedFunction.SubFunctionsNames.Count; i++) { risSplitBtn.Items.Add(RibbonHelpers.AddBigButton( loadedFunction.SubFunctionsNames[i], Language.GetFunctionLocalName(loadedFunction.Name, loadedFunction.SubFunctionsLNames[i], i + 1), GetBigIconForSubFunction(loadedFunction, i), Language.GetFunctionShortDescription(loadedFunction.Name, loadedFunction.SubDescriptions[i], i + 1), Orientation.Horizontal, Language.GetFunctionFullDescription(loadedFunction.Name, loadedFunction.SubFullDescriptions[i], i + 1), loadedFunction.SubHelpImages[i])); } ribRowPanel.Items.Add(risSplitBtn); } // Иначе просто добавляем большую кнопку else { RibbonButton ribbonButton = RibbonHelpers.AddBigButton( loadedFunction.Name, Language.GetFunctionLocalName(loadedFunction.Name, loadedFunction.LName), GetBigIcon(loadedFunction), Language.GetFunctionShortDescription(loadedFunction.Name, loadedFunction.Description), Orientation.Vertical, Language.GetFunctionFullDescription(loadedFunction.Name, loadedFunction.FullDescription), loadedFunction.ToolTipHelpImage); ribRowPanel.Items.Add(ribbonButton); } ribSourcePanel.Items.Add(ribRowPanel); } #endregion } }// foreach functions if (ribRowPanel.Items.Any() & !lastWasBig) { ribSourcePanel.Items.Add(ribRowPanel); } // Если в группе нет функций(например отключены), то не добавляем эту группу if (!hasFunctions) { ribTab.Panels.Remove(ribPanel); } } } } catch (Exception exception) { ExceptionBox.Show(exception); } }
public void SetButtonFocus(RibbonButton button, SolidColorBrush brushColor, double thicknessSize) { button.BorderBrush = brushColor; button.BorderThickness = new Thickness(thicknessSize); }
/// <summary> /// Draws a SplitDropDown button with the dropdown area pressed /// </summary> /// <param name="e"></param> /// <param name="button"></param> public void DrawSplitButtonDropDownPressed(RibbonItemRenderEventArgs e, RibbonButton button) { }
private void btn_Click(object sender, RibbonControlEventArgs e) { RibbonButton rcButton = (RibbonButton)sender; AddComment(rcButton.Tag.ToString()); }
private void AssignCommandToButton(RibbonButton theButton, RoutedCommand theCommand) { try { theButton.Command = theCommand; } catch (Exception ex) { string err = ex.ToString(); } }
/// <summary> /// Draws the button as a selected button /// </summary> /// <param name="g"></param> /// <param name="button"></param> public void DrawButtonSelected(Graphics g, RibbonButton button) { DrawButtonSelected(g, button.Bounds, ButtonCorners(button)); }
/// <summary> /// Dang ky hot key, shortcut key /// </summary> #region Dang ky hot key, shortcut key /// <summary> /// Binding HotKey /// </summary> private void BindHotkey() { foreach (var child in Toolbar.Children) { if (child.GetType() == typeof(RibbonButton)) { RibbonButton tlb = (RibbonButton)child; KeyBinding key = new KeyBinding(); string strTinhNang = tlb.Name.Substring(3, tlb.Name.Length - 3); if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.NHAP_DU_LIEU))) { KeyGesture keyg = new KeyGesture(Key.I, ModifierKeys.Shift); key = new KeyBinding(ImportCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.SUA))) { KeyGesture keyg = new KeyGesture(Key.M, ModifierKeys.Control); key = new KeyBinding(ModifyCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XOA))) { KeyGesture keyg = new KeyGesture(Key.Delete, ModifierKeys.Shift); key = new KeyBinding(DeleteCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.NHAN_BAN))) { KeyGesture keyg = new KeyGesture(Key.V, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(CloneCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.LUU_TAM))) { KeyGesture keyg = new KeyGesture(Key.H, ModifierKeys.Control); key = new KeyBinding(HoldCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.LUU))) { KeyGesture keyg = new KeyGesture(Key.S, ModifierKeys.Control); key = new KeyBinding(SaveCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.BANG_KE))) { KeyGesture keyg = new KeyGesture(Key.S, ModifierKeys.Shift); key = new KeyBinding(CashStmtCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.DUYET))) { KeyGesture keyg = new KeyGesture(Key.A, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(ApproveCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TU_CHOI_DUYET))) { KeyGesture keyg = new KeyGesture(Key.R, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(RefuseCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.THOAI_DUYET))) { KeyGesture keyg = new KeyGesture(Key.C, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(CancelCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XEM_TRUOC))) { KeyGesture keyg = new KeyGesture(Key.W, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(PreviewCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XEM))) { KeyGesture keyg = new KeyGesture(Key.W, ModifierKeys.Control); key = new KeyBinding(ViewCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XUAT_DU_LIEU))) { KeyGesture keyg = new KeyGesture(Key.E, ModifierKeys.Shift); key = new KeyBinding(ExportCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TIM_KIEM))) { KeyGesture keyg = new KeyGesture(Key.S, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(SearchCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TRO_GIUP))) { KeyGesture keyg = new KeyGesture(Key.F1, ModifierKeys.None); key = new KeyBinding(HelpCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.DONG))) { KeyGesture keyg = new KeyGesture(Key.Escape, ModifierKeys.None); key = new KeyBinding(CloseCommand, keyg); key.Gesture = keyg; } InputBindings.Add(key); } } }
private void InitLists() { Image[] images = new Image[255]; RibbonProfessionalRenderer rend = new RibbonProfessionalRenderer(); BackColor = rend.ColorTable.RibbonBackground; Random r = new Random(); #region Color Squares using (GraphicsPath path = RibbonProfessionalRenderer.RoundRectangle(new Rectangle(3, 3, 26, 26), 4)) { using (GraphicsPath outer = RibbonProfessionalRenderer.RoundRectangle(new Rectangle(0, 0, 32, 32), 4)) { for (int i = 0; i < images.Length; i++) { Bitmap b = new Bitmap(32, 32); using (Graphics g = Graphics.FromImage(b)) { g.SmoothingMode = SmoothingMode.AntiAlias; using (SolidBrush br = new SolidBrush(Color.FromArgb(255, i * (255 / images.Length), 0))) { g.FillPath(br, path); } using (Pen p = new Pen(Color.White, 3)) { g.DrawPath(p, path); } g.DrawPath(Pens.Wheat, path); g.DrawString(Convert.ToString(i + 1), Font, Brushes.White, new Point(10, 10)); } images[i] = b; RibbonButton btn = new RibbonButton(); btn.Image = b; lst.Buttons.Add(btn); } } } //lst.DropDownItems.Add(new RibbonSeparator("Available styles")); RibbonButtonList lst2 = new RibbonButtonList(); for (int i = 0; i < images.Length; i++) { RibbonButton btn = new RibbonButton(); btn.Image = images[i]; lst2.Buttons.Add(btn); } lst.DropDownItems.Add(lst2); lst.DropDownItems.Add(new RibbonButton("Save selection as a new quick style...")); lst.DropDownItems.Add(new RibbonButton("Erase Format")); lst.DropDownItems.Add(new RibbonButton("Apply style...")); #endregion #region Theme Colors RibbonButton[] buttons = new RibbonButton[30]; int square = 16; int squares = 4; int sqspace = 2; for (int i = 0; i < buttons.Length; i++) { #region Create color squares Bitmap colors = new Bitmap((square + sqspace) * squares, square + 1); string[] colorss = new string[squares]; using (Graphics g = Graphics.FromImage(colors)) { for (int j = 0; j < 4; j++) { Color sqcolor = GetRandomColor(r); colorss[j] = sqcolor.Name; using (SolidBrush b = new SolidBrush(sqcolor)) { g.FillRectangle(b, new Rectangle(j * (square + sqspace), 0, square, square)); } g.DrawRectangle(Pens.Gray, new Rectangle(j * (square + sqspace), 0, square, square)); } } #endregion buttons[i] = new RibbonButton(colors); buttons[i].Text = string.Join(", ", colorss); ; buttons[i].MaxSizeMode = RibbonElementSizeMode.Medium; buttons[i].MinSizeMode = RibbonElementSizeMode.Medium; } RibbonButtonList blst = new RibbonButtonList(buttons); blst.FlowToBottom = false; blst.ItemsSizeInDropwDownMode = new Size(1, 10); itemColors.DropDownItems.Insert(0, blst); itemColors.DropDownResizable = true; #endregion }
private void InitializeComponents() { // Instantiate Controls HelpButton = new RibbonHelpButton(ribbon, (uint)RibbonMarkupCommands.HelpButton); ApplicationMenu = new RibbonApplicationMenu(ribbon, (uint)RibbonMarkupCommands.ApplicationMenu); RecentItems = new RibbonRecentItems(ribbon, (uint)RibbonMarkupCommands.RecentItems); ButtonNew = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ButtonNew); ButtonOpen = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ButtonOpen); ButtonSave = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ButtonSave); SaveAs = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SaveAs); SaveAll = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SaveAll); Export = new RibbonDropDownButton(ribbon, (uint)RibbonMarkupCommands.Export); ExportAsPNG = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExportAsPNG); ExportAsJPG = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExportAsJPG); Close = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Close); ButtonExit = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ButtonExit); TabHome = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabHome); NewNode = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.NewNode); NewChildNode = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NewChildNode); NewLongNode = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NewLongNode); NewNodeAbove = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NewNodeAbove); NewNodeBelow = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NewNodeBelow); NewNodeParent = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NewNodeParent); GrpEdit = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpEdit); EditText = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.EditText); EditLong = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.EditLong); DeleteNode = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.DeleteNode); GrpClipboard = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpClipboard); Paste = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Paste); PasteAsText = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.PasteAsText); Cut = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Cut); Copy = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Copy); FormatPainter = new RibbonToggleButton(ribbon, (uint)RibbonMarkupCommands.FormatPainter); GrpFont = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpFont); RichFont = new RibbonFontControl(ribbon, (uint)RibbonMarkupCommands.RichFont); GrpFormat = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpFormat); BackColor = new RibbonDropDownColorPicker(ribbon, (uint)RibbonMarkupCommands.BackColor); ClearFormatting = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ClearFormatting); GrpIcons = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpIcons); IconsGallery = new RibbonInRibbonGallery(ribbon, (uint)RibbonMarkupCommands.IconsGallery); RemoveLastIcon = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.RemoveLastIcon); RemoveAllIcons = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.RemoveAllIcons); LaunchIconsDialog = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LaunchIconsDialog); TabEdit = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabEdit); GrpSelect = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpSelect); SelectAll = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectAll); SelectSiblings = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectSiblings); SelectAncestors = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectAncestors); SelectChildren = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectChildren); SelectDescendents = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectDescendents); SelectDescendentsUpto1 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectDescendentsUpto1); SelectDescendentsUpto2 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectDescendentsUpto2); SelectDescendentsUpto3 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectDescendentsUpto3); SelectDescendentsUpto4 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectDescendentsUpto4); SelectDescendentsUpto5 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectDescendentsUpto5); ExpandOnSelect = new RibbonCheckBox(ribbon, (uint)RibbonMarkupCommands.ExpandOnSelect); SelectLevel = new RibbonDropDownButton(ribbon, (uint)RibbonMarkupCommands.SelectLevel); SelectLevel1 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectLevel1); SelectLevel2 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectLevel2); SelectLevel3 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectLevel3); SelectLevel4 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectLevel4); SelectLevel5 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectLevel5); SelectLevelCurrent = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SelectLevelCurrent); GrpExpand = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpExpand); ExpandAll = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandAll); CollapseAll = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.CollapseAll); ToggleCurrent = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ToggleCurrent); ToggleBranch = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ToggleBranch); ExpandMapToCurrentLevel = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandMapToCurrentLevel); ExpandMapToLevel1 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandMapToLevel1); ExpandMapToLevel2 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandMapToLevel2); ExpandMapToLevel3 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandMapToLevel3); ExpandMapToLevel4 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandMapToLevel4); ExpandMapToLevel5 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ExpandMapToLevel5); GrpNavigate = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNavigate); NavigateToCenter = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NavigateToCenter); NavigateToFirstSibling = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NavigateToFirstSibling); NavigateToLastSibling = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NavigateToLastSibling); GrpMove = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpMove); MoveUp = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.MoveUp); MoveDown = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.MoveDown); GrpSort = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpSort); SortAlphabetic = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SortAlphabetic); SortDueDate = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SortDueDate); SortNodeCount = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SortNodeCount); SortCreateDate = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SortCreateDate); SortModifiedDate = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.SortModifiedDate); SortOrder = new RibbonToggleButton(ribbon, (uint)RibbonMarkupCommands.SortOrder); GrpUndo = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpUndo); Undo = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Undo); Redo = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Redo); TabInsert = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabInsert); GrpHyperlink = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpHyperlink); Hyperlink = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Hyperlink); HyperlinkFile = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.HyperlinkFile); HyperlinkFolder = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.HyperlinkFolder); RemoveHyperlink = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.RemoveHyperlink); GrpNote = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNote); InsertNote = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.InsertNote); GrpTask = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpTask); AddTask = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AddTask); AddTaskToday = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AddTaskToday); AddTaskTomorrow = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AddTaskTomorrow); AddTaskNextWeek = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AddTaskNextWeek); AddTaskNextMonth = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AddTaskNextMonth); AddTaskNextQuarter = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AddTaskNextQuarter); CompleteTask = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.CompleteTask); RemoveTask = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.RemoveTask); TabFormat = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabFormat); GrpNodeFormat = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNodeFormat); NodeShape = new RibbonDropDownGallery(ribbon, (uint)RibbonMarkupCommands.NodeShape); ClearShapeFormat = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ClearShapeFormat); LineColor = new RibbonDropDownColorPicker(ribbon, (uint)RibbonMarkupCommands.LineColor); LinePattern = new RibbonDropDownButton(ribbon, (uint)RibbonMarkupCommands.LinePattern); LinePatternSolid = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LinePatternSolid); LinePatternDashed = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LinePatternDashed); LinePatternDotted = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LinePatternDotted); LinePatternMixed = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LinePatternMixed); LineThickness = new RibbonDropDownButton(ribbon, (uint)RibbonMarkupCommands.LineThickness); LineThickness1 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LineThickness1); LineThickness2 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LineThickness2); LineThickness4 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.LineThickness4); GrpNodeStyle = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNodeStyle); NodeStyleGallery = new RibbonInRibbonGallery(ribbon, (uint)RibbonMarkupCommands.NodeStyleGallery); CreateNodeStyle = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.CreateNodeStyle); GrpClearFormat = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpClearFormat); TabView = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabView); GrpViewTask = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpViewTask); ViewCalendar = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ViewCalendar); ViewTaskList = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ViewTaskList); GrpViewNote = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpViewNote); ViewNote = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ViewNote); TabGroupNote = new RibbonTabGroup(ribbon, (uint)RibbonMarkupCommands.TabGroupNote); TabNoteEditor = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabNoteEditor); GrpNoteFont = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNoteFont); GrpNoteClearFormat = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNoteClearFormat); GrpParagraph = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpParagraph); Bullets = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Bullets); Numbers = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Numbers); Outdent = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Outdent); Indent = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Indent); AlignLeft = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AlignLeft); AlignCenter = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AlignCenter); AlignRight = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.AlignRight); Justify = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.Justify); GrpNoteStyles = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNoteStyles); NoteHeading1 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteHeading1); NoteHeading2 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteHeading2); NoteHeading3 = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteHeading3); NoteNormal = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteNormal); GrpNoteTable = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNoteTable); NoteInsertTable = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteInsertTable); GrpNoteEditHtml = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpNoteEditHtml); NoteEditHtml = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.NoteEditHtml); TabGroupNoteTable = new RibbonTabGroup(ribbon, (uint)RibbonMarkupCommands.TabGroupNoteTable); TabNoteTableLayout = new RibbonTab(ribbon, (uint)RibbonMarkupCommands.TabNoteTableLayout); GrpCustomizeTable = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpCustomizeTable); ModifyTableProperties = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.ModifyTableProperties); GrpTableDelete = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpTableDelete); DeleteRow = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.DeleteRow); DeleteColumn = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.DeleteColumn); DeleteTable = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.DeleteTable); GrpTableInsert = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpTableInsert); InsertRowAbove = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.InsertRowAbove); InsertRowBelow = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.InsertRowBelow); InsertColumnLeft = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.InsertColumnLeft); InsertColumnRight = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.InsertColumnRight); GrpTableMove = new RibbonGroup(ribbon, (uint)RibbonMarkupCommands.GrpTableMove); MoveRowUp = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.MoveRowUp); MoveRowDown = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.MoveRowDown); MoveColumnLeft = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.MoveColumnLeft); MoveColumnRight = new RibbonButton(ribbon, (uint)RibbonMarkupCommands.MoveColumnRight); }
public void Execute(object parameter) { Document doc = acApp.DocumentManager.MdiActiveDocument; if (parameter is RibbonButton) { RibbonButton button = parameter as RibbonButton; var AX = new AddXref(); var UX = new UnloadXref(); switch (button.Text) { case ("Add"): MC.AddXref(); break; case ("Unload"): MC.UnloadXRef(); break; case ("Detach"): MC.DetachXRef(); break; case ("Purge multiple drawings"): MC.PurgeDrawings(); break; case ("This drawing"): MC.LayerUpdateThisDrawing(); break; case ("Multiple drawings"): MC.LayerUpdate(); break; case ("Change attribute value"): MC.ChangeAttribute_dialog(); break; case ("Select layer this drawing"): MC.AddLayerThisDrawing(); break; case ("Select layer xref"): MC.AddLayerXref(); break; case ("Edit layer config"): MC.EditLayerConfig(); break; case ("Top Down"): MC.OneVportTopDown(); break; case ("Generate Attribute List"): MC.GetAllAttributes(); break; case ("Adjust Cable Trays"): MC.AdjustCableTrays(); break; default: break; } } }
private void CreateRibbon() { { RibbonButtonTab tab = new RibbonButtonTab(); tab.Name = "开始"; tab.DropDown = new RibbonDropDownMenu(this.Ribbon) { Menu = CreateStartMenu() }; this.Ribbon.Tabs.Add(tab); } { RibbonTab tab = new RibbonTab(); tab.Name = "主页"; this.Ribbon.Tabs.Add(tab); { RibbonButtonGroup group = new RibbonButtonGroup(); group.Name = "剪贴板"; tab.TabPanel.Groups.Add(group); { RibbonButton button = new RibbonButton(); button.BigImage = ButtonImages.Paste; button.Name = "粘帖1"; group.BigItems.Add(button); } { RibbonButton button = new RibbonButton(); button.BigImage = ButtonImages.Paste; button.Name = "粘帖2"; button.Enabled = false; group.BigItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ButtonImages.CutHS; button.Name = "剪切"; group.SmallItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ButtonImages.CopyHS; button.Name = "复制"; button.ButtonStyle = RibbonButtonStyle.SplitButton; group.SmallItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ButtonImages.Color_linecolor; button.Name = "格式刷"; button.ButtonStyle = RibbonButtonStyle.DropDownButton; group.SmallItems.Add(button); } } { RibbonButtonGroup group = new RibbonButtonGroup(); group.Name = "字体"; tab.TabPanel.Groups.Add(group); { RibbonButton button = new RibbonButton(); button.BigImage = ButtonImages.Paste; button.Name = "粘帖3"; button.ButtonStyle = RibbonButtonStyle.DropDownButton; group.BigItems.Add(button); } { RibbonButton button = new RibbonButton(); button.BigImage = ButtonImages.Paste; button.Name = "粘帖4"; button.ButtonStyle = RibbonButtonStyle.SplitButton; group.BigItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ButtonImages.Window1; button.Name = "一个窗口"; button.ButtonStyle = RibbonButtonStyle.GroupedToggleButton; button.ToggleGroup = 0; button.Toggled = true; group.SmallItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ButtonImages.Window2; button.Name = "两个窗口"; button.ButtonStyle = RibbonButtonStyle.GroupedToggleButton; button.ToggleGroup = 0; group.SmallItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ButtonImages.Window3; button.Name = "三个窗口"; button.ButtonStyle = RibbonButtonStyle.GroupedToggleButton; button.ToggleGroup = 0; button.Enabled = false; group.SmallItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ButtonImages.Arrow1; button.Name = "第一箭头"; button.ButtonStyle = RibbonButtonStyle.ToggleButton; group.SmallItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ButtonImages.Arrow2; button.Name = "第二箭头"; button.ButtonStyle = RibbonButtonStyle.ToggleButton; group.SmallItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ButtonImages.Arrow3; button.Name = "第三箭头"; button.ButtonStyle = RibbonButtonStyle.ToggleButton; group.SmallItems.Add(button); } } { RibbonToolStripGroup group = new RibbonToolStripGroup(); group.Name = "段落"; tab.TabPanel.Groups.Add(group); { RibbonToolStrip tool = new RibbonToolStrip(); tool.NormalLine = 0; tool.CompactLine = 0; group.ToolStrips.Add(tool); { RibbonButton button = new RibbonButton(); button.SmallImage = ToolImages.ItemNumber; tool.ToolItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ToolImages.ItemDot; button.ButtonStyle = RibbonButtonStyle.DropDownButton; button.Enabled = false; tool.ToolItems.Add(button); } } { RibbonToolStrip tool = new RibbonToolStrip(); tool.NormalLine = 0; tool.CompactLine = 0; group.ToolStrips.Add(tool); { RibbonButton button = new RibbonButton(); button.SmallImage = ToolImages.TabIn; tool.ToolItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ToolImages.TabOut; tool.ToolItems.Add(button); } } { RibbonToolStrip tool = new RibbonToolStrip(); tool.NormalLine = 1; tool.CompactLine = 1; group.ToolStrips.Add(tool); { RibbonButton button = new RibbonButton(); button.SmallImage = ToolImages.AlignLeft; button.Toggled = true; button.ToggleGroup = 0; button.ButtonStyle = RibbonButtonStyle.GroupedToggleButton; tool.ToolItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ToolImages.AlignCenter; button.ToggleGroup = 0; button.ButtonStyle = RibbonButtonStyle.GroupedToggleButton; tool.ToolItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ToolImages.AlignRight; button.ToggleGroup = 0; button.ButtonStyle = RibbonButtonStyle.GroupedToggleButton; tool.ToolItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ToolImages.AlignFull; button.ToggleGroup = 0; button.ButtonStyle = RibbonButtonStyle.GroupedToggleButton; tool.ToolItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ToolImages.AlignExpand; button.ToggleGroup = 0; button.ButtonStyle = RibbonButtonStyle.GroupedToggleButton; button.Enabled = false; tool.ToolItems.Add(button); } } { RibbonToolStrip tool = new RibbonToolStrip(); tool.NormalLine = 1; tool.CompactLine = 1; group.ToolStrips.Add(tool); { RibbonButton button = new RibbonButton(); button.SmallImage = ToolImages.LinePadding; tool.ToolItems.Add(button); } } { RibbonToolStrip tool = new RibbonToolStrip(); tool.NormalLine = 0; tool.CompactLine = 2; group.ToolStrips.Add(tool); { RibbonButton button = new RibbonButton(); button.SmallImage = ToolImages.TableBorder; button.ButtonStyle = RibbonButtonStyle.DropDownButton; button.DropDown = new RibbonDropDownMenu(this.Ribbon) { Menu = CreateTableMenu() }; tool.ToolItems.Add(button); } { RibbonButton button = new RibbonButton(); button.SmallImage = ToolImages.SortAscending; button.ButtonStyle = RibbonButtonStyle.SplitButton; tool.ToolItems.Add(button); } } } } { RibbonTab tab = new RibbonTab(); tab.Name = "插入"; this.Ribbon.Tabs.Add(tab); { RibbonControlGroup group = new RibbonControlGroup(); group.Name = "好复杂啊"; tab.TabPanel.Groups.Add(group); RibbonControlSizingPolicy[] policies = new RibbonControlSizingPolicy[] { RibbonControlSizingPolicy.Big, RibbonControlSizingPolicy.BigSmall, RibbonControlSizingPolicy.BigCompact, RibbonControlSizingPolicy.Small, RibbonControlSizingPolicy.SmallCompact, RibbonControlSizingPolicy.Compact }; Image[] smalls = new Image[] { ControlImages.a1, ControlImages.b1, ControlImages.c1, ControlImages.d1, ControlImages.e1, ControlImages.f1 }; Image[] bigs = new Image[] { ControlImages.a2, ControlImages.b2, ControlImages.c2, ControlImages.d2, ControlImages.e2, ControlImages.f2 }; RibbonButtonStyle[] styles = new RibbonButtonStyle[] { RibbonButtonStyle.PushButton, RibbonButtonStyle.DropDownButton, RibbonButtonStyle.SplitButton }; for (int i = 0; i < 6; i++) { RibbonControlGroupPanel panel = new RibbonControlGroupPanel(); panel.Policy = policies[i]; group.Panels.Add(panel); for (int j = 0; j < 3; j++) { RibbonButton button = new RibbonButton(); button.SmallImage = smalls[i]; button.BigImage = bigs[i]; button.ButtonStyle = styles[j]; button.Name = panel.Policy.ToString() + " " + (i + 1).ToString(); panel.ControlItems.Add(button); } } } { RibbonControlGroup group = new RibbonControlGroup(); group.Name = "好复杂啊"; RibbonControlSizingPolicy[] policies = new RibbonControlSizingPolicy[] { RibbonControlSizingPolicy.Big, RibbonControlSizingPolicy.BigSmall, RibbonControlSizingPolicy.BigCompact, RibbonControlSizingPolicy.Small, RibbonControlSizingPolicy.SmallCompact, RibbonControlSizingPolicy.Compact }; Image[] smalls = new Image[] { ControlImages.a1, ControlImages.b1, ControlImages.c1, ControlImages.d1, ControlImages.e1, ControlImages.f1 }; Image[] bigs = new Image[] { ControlImages.a2, ControlImages.b2, ControlImages.c2, ControlImages.d2, ControlImages.e2, ControlImages.f2 }; RibbonButtonStyle[] styles = new RibbonButtonStyle[] { RibbonButtonStyle.PushButton, RibbonButtonStyle.DropDownButton, RibbonButtonStyle.SplitButton }; for (int i = 0; i < 6; i++) { RibbonControlGroupPanel panel = new RibbonControlGroupPanel(); panel.Policy = policies[i]; group.Panels.Add(panel); for (int j = 0; j < 3; j++) { RibbonButton button = new RibbonButton(); button.SmallImage = smalls[i]; button.BigImage = bigs[i]; button.ButtonStyle = styles[j]; button.Name = panel.Policy.ToString() + " " + (i + 1).ToString(); panel.ControlItems.Add(button); } } ((tab.TabPanel.Groups[0] as RibbonControlGroup).Panels[0].ControlItems[1] as RibbonButton).DropDown = new RibbonDropDownGroup(this.Ribbon) { Group = group }; } } { RibbonTab tab = new RibbonTab(); tab.Name = "页面布局"; this.Ribbon.Tabs.Add(tab); } { RibbonTab tab = new RibbonTab(); tab.Name = "引用"; this.Ribbon.Tabs.Add(tab); } { RibbonTab tab = new RibbonTab(); tab.Name = "设计"; this.Ribbon.Tabs.Add(tab); } { RibbonTab tab = new RibbonTab(); tab.Name = "布局"; this.Ribbon.Tabs.Add(tab); } { RibbonTabGroup group = new RibbonTabGroup(); group.Name = "表格工具"; group.FirstIndex = 5; group.LastIndex = 6; this.Ribbon.TabGroups.Add(group); } UpdateRibbon(false); }
private async void SetRibbon() { string tmp; string[] ribbonTabs; RibbonTab ribbonTab; RibbonGroup ribbonGroup; string[] ribbonGroups; RibbonButton ribbonButton; string[] ribbonButtons; tmp = this.GetAttribute("Ribbon.RibbonTabs"); if (!tmp.IsNullOrEmpty()) { ribbonTabs = tmp.Split(','); foreach (string tabname in ribbonTabs) { ribbonTab = new RibbonTab() { KeyTip = this.GetAttribute(string.Format("Ribbon.RibbonTab_{0}.KeyTip", tabname)), Header = this.GetAttribute(string.Format("Ribbon.RibbonTab_{0}.Header", tabname)), Name = tabname }; //this.ribbon.Items.Add(ribbonTab); tmp = this.GetAttribute(string.Format("Ribbon.RibbonTab_{0}.RibbonGroups", tabname)); if (!tmp.IsNullOrEmpty()) { ribbonGroups = tmp.Split(','); foreach (string groupname in ribbonGroups) { ribbonGroup = new RibbonGroup() { KeyTip = this.GetAttribute(string.Format("Ribbon.RibbonGroup_{0}.KeyTip", groupname)), Header = this.GetAttribute(string.Format("Ribbon.RibbonGroup_{0}.Header", groupname)) }; ribbonTab.Items.Add(ribbonGroup); tmp = this.GetAttribute(string.Format("Ribbon.RibbonGroup_{0}.RibbonButtons", groupname)); if (!tmp.IsNullOrEmpty()) { ribbonButtons = tmp.Split(','); foreach (string buttonname in ribbonButtons) { ribbonButton = new RibbonButton() { KeyTip = this.GetAttribute(string.Format("Ribbon.RibbonButton_{0}.KeyTip", buttonname)), Label = this.GetAttribute(string.Format("Ribbon.RibbonButton_{0}.Label", buttonname)), LargeImageSource = await this.GetAttributeMediaWebImage(string.Format("Ribbon.RibbonButton_{0}.LargeImageSource", buttonname)), SmallImageSource = await this.GetAttributeMediaWebImage(string.Format("Ribbon.RibbonButton_{0}.SmallImageSource", buttonname)), Command = new MVVM.DelegateCommand( () => { (this.DataContext as ViewModel.ModernToolbarViewModel).RibbonButtonProcess(buttonname); }, () => { return(true); } ), Tag = buttonname, CanAddToQuickAccessToolBarDirectly = true, Name = buttonname }; ribbonGroup.Items.Add(ribbonButton); } } } } } } }
public static string label(this RibbonButton ribbonButton) { return((string)ribbonButton.wpfInvoke( () => { return ribbonButton.Label; })); }
public static void LoadState(RibbonWindow ribbonWindow, Ribbon ribbon) { ribbon.IsMinimized = Settings.Current.RibbonIsMinimized; ribbon.ShowQuickAccessToolBarOnTop = Settings.Current.ShowQuickAccessToolBarOnTop; #region Load the QuickAccessToolbarButtonCollection try { if (!string.IsNullOrEmpty(Settings.Current.RibbonQuickAccessToolBar)) { QuickAccessToolbarButtonCollection buttons = null; XmlSerializer bf = new XmlSerializer(typeof(QuickAccessToolbarButtonCollection)); using (StringReader sr = new StringReader(Settings.Current.RibbonQuickAccessToolBar)) { buttons = (QuickAccessToolbarButtonCollection)bf.Deserialize(sr); } if (buttons != null) { foreach (QuickAccessToolbarButton qaButton in buttons) { RibbonButton ribbonElem = ribbonWindow.FindName(qaButton.Name) as RibbonButton; RibbonButton rButton = new RibbonButton() { Label = qaButton.Label, KeyTip = qaButton.KeyTip, //ToolTip = qaButton.ToolTip, ToolTipDescription = qaButton.ToolTipDescription, QuickAccessToolBarId = qaButton.QuickAccessToolBarId, Name = qaButton.Name }; if (!string.IsNullOrEmpty(qaButton.LargeImageSource)) { rButton.LargeImageSource = new BitmapImage(new Uri(qaButton.LargeImageSource)); } if (!string.IsNullOrEmpty(qaButton.SmallImageSource)) { rButton.SmallImageSource = new BitmapImage(new Uri(qaButton.SmallImageSource)); } if (ribbonElem != null && ribbonElem.Command != null) { rButton.Command = ribbonElem.Command; } else { // Noch im Applicationmenü suchen RibbonApplicationMenuItem ribbonMenuItem = ribbon.ApplicationMenu.FindName(qaButton.Name) as RibbonApplicationMenuItem; if (ribbonMenuItem != null) { rButton.Command = ribbonMenuItem.Command; } } ribbon.QuickAccessToolBar.Items.Add(rButton); } } } } catch { // Ignorieren, falls die Toolbar nicht geladen werden kann. } #endregion }
protected void CreateUserMenu() { SqlBaseProvider.GetManMenus(Program.ManInfo, Program.ManInfo.Man.ManID); SysMenuGroups mgs = Program.ManInfo.Menus; if ((mgs == null) || (mgs.Count <= 0)) { return; } int i, j, k; msMain.Items.Clear(); for (i = 0; i < mgs.Count; i++) { SysMenuGroup mgitem = mgs[i]; if ((mgitem.Menus == null) || (mgitem.Menus.Count <= 0)) { continue; } ToolStripMenuItem gi = new ToolStripMenuItem(); gi.Name = "MenuGroup" + mgitem.MgID.ToString(); gi.Text = mgitem.MgName; for (j = 0; j < mgitem.Menus.Count; j++) { SysMenu mitem = mgitem.Menus[j]; ToolStripMenuItem mi = new ToolStripMenuItem(); mi.Name = mitem.MCode + "-" + mitem.MFunction; mi.Text = mitem.MName; if (!String.IsNullOrEmpty(mitem.MFunction)) { MenuAuth ma = new MenuAuth(); ma.MID = mitem.MID; ma.MCode = mitem.MCode; ma.MFunction = mitem.MFunction; ma.MShortcut = mitem.MShortcut; ma.Auth = mitem.MAuth; Program.ManInfo.Auths.Add(ma); } gi.DropDownItems.Add(mi); if (mitem.IsLine) { gi.DropDownItems.Add(new ToolStripSeparator()); } if ((mitem.SubMenus != null) && (mitem.SubMenus.Count > 0)) { AddSubMenu(mitem, mi); } else { if (!String.IsNullOrEmpty(mitem.MFunction)) { mi.Click += new EventHandler(Menu_Click); } } } msMain.Items.Add(gi); } RibTabs rts = Program.ManInfo.Ribbons; RibTab rt; bool isRibTab = false; ribMain.Tabs.Clear(); for (i = 0; i < rts.Count; i++) { isRibTab = false; rt = rts[i]; // Ribbon Tab's Panels Count为0,则不做处理 if (rt.Panels.Count <= 0) { continue; } // 判断该Tab下的所有Panel是否包含了按钮,如果没有,则不做处理 for (j = 0; j < rt.Panels.Count; j++) { if (rt.Panels[j].Buttons.Count <= 0) { continue; } else { isRibTab = true; break; } } if (!isRibTab) { continue; } RibbonTab rTab = new RibbonTab(); rTab.Text = rt.RibTabName; for (j = 0; j < rt.Panels.Count; j++) { if (rt.Panels[j].Buttons.Count > 0) { RibbonPanel rPanel = new RibbonPanel(); rPanel.Text = rt.Panels[j].RibPanelName; for (k = 0; k < rt.Panels[j].Buttons.Count; k++) { RibbonButton rButton = new RibbonButton(); rButton.Text = rt.Panels[j].Buttons[k].RibBtnName; if (!String.IsNullOrEmpty(rt.Panels[j].Buttons[k].MFunction)) { rButton.Function = rt.Panels[j].Buttons[k].RibCode + "-" + rt.Panels[j].Buttons[k].MCode + "-" + rt.Panels[j].Buttons[k].MFunction; rButton.Click += new EventHandler(Ribbon_Click); } if (rt.Panels[j].Buttons[k].RibImageIndex > -1) { if (ilRibbon.Images.Count > rt.Panels[j].Buttons[k].RibImageIndex) { rButton.Image = ilRibbon.Images[rt.Panels[j].Buttons[k].RibImageIndex]; } } rPanel.Items.Add(rButton); } rTab.Panels.Add(rPanel); } } ribMain.Tabs.Add(rTab); } }
private ButtonItem ProcessButton(RibbonButton button) { ButtonItem buttonItem = new ButtonItem(); buttonItem.Name = buttonItem.Text = button.Text; if (button.Image != null) buttonItem.Image = button.Image; buttonItem.Tooltip = button.ToolTip; buttonItem.ButtonStyle = GetButtonStyle(button.DisplayType); buttonItem.ImagePosition = GetImageLocation(button.ImageLocation); buttonItem.AutoCheckOnClick = button.IsCheckable; if (button.IsCheckable) buttonItem.Checked = button.CheckedState; buttonItem.CheckedChanged += button.CheckedEventHandler; buttonItem.Click += button.ClickEventHandler; foreach (var dropDownItem in button.DropDownItems) { ButtonItem dropDownButton = new ButtonItem(); dropDownButton.Text = dropDownItem.Text; dropDownButton.Tooltip = dropDownItem.ToolTip; dropDownButton.Click += dropDownItem.ClickEventHandler; dropDownButton.CheckedChanged += button.CheckedEventHandler; dropDownButton.AutoCheckOnClick = button.IsCheckable; if (button.IsCheckable) dropDownButton.Checked = button.CheckedState; buttonItem.SubItems.Add(dropDownButton); } Buttons[button] = buttonItem; return buttonItem; }
public btnTransparency() { //base.Id=(this.name); //base.Name=(this.name); //base.Text=(this.name); //base.IsEnabled=(true); //base.add_DropDownOpened(new EventHandler<EventArgs>(this.btnTransparency_DropDownOpened)); //base.Image=(ArcGISRibbon.loadImage(this.smallImageName)); //base.LargeImage=(ArcGISRibbon.loadImage(this.largeImageName)); //base.Size=(this.btnsize); //base.ShowImage=(true); //base.ShowText=(false); //base.Orientation=(this.orientation); //base.KeyTip=("This is a keytip"); //base.ToolTip=(ArcGISRibbon.createToolTip(this.tooltipTitle, this.tooltipDescr)); //base.CommandHandler=(new btn_TransparencyCommandHandler()); //base.HelpSource=(ArcGISRibbon.HelpPath); //base.set_ListButtonStyle(0); //RibbonRowPanel ribbonRowPanel = new RibbonRowPanel(); //ribbonRowPanel.set_GroupName(AfaStrings.RBN_BTN_TRANSPARENCY); //this.btn100 = new btnTransparencyPercent("100%", 100, (RibbonToolTip)base.get_ToolTip()); //ribbonRowPanel.Items.Add(this.btn100); //base.Items.Add(this.btn100); //this.btn90 = new btnTransparencyPercent("90%", 90, (RibbonToolTip)base.get_ToolTip()); //ribbonRowPanel.Items.Add(this.btn90); //base.Items.Add(this.btn90); //this.btn80 = new btnTransparencyPercent("80%", 80, (RibbonToolTip)base.get_ToolTip()); //ribbonRowPanel.Items.Add(this.btn80); //base.Items.Add(this.btn80); //this.btn70 = new btnTransparencyPercent("70%", 70, (RibbonToolTip)base.get_ToolTip()); //ribbonRowPanel.Items.Add(this.btn70); //base.Items.Add(this.btn70); //this.btn60 = new btnTransparencyPercent("60%", 60, (RibbonToolTip)base.get_ToolTip()); //ribbonRowPanel.Items.Add(this.btn60); //base.Items.Add(this.btn60); //this.btn50 = new btnTransparencyPercent("50%", 50, (RibbonToolTip)base.get_ToolTip()); //ribbonRowPanel.Items.Add(this.btn50); //base.Items.Add(this.btn50); //this.btn40 = new btnTransparencyPercent("40%", 40, (RibbonToolTip)base.get_ToolTip()); //ribbonRowPanel.Items.Add(this.btn40); //base.Items.Add(this.btn40); //this.btn30 = new btnTransparencyPercent("30%", 30, (RibbonToolTip)base.get_ToolTip()); //ribbonRowPanel.Items.Add(this.btn30); //base.Items.Add(this.btn30); //this.btn20 = new btnTransparencyPercent("20%", 20, (RibbonToolTip)base.get_ToolTip()); //ribbonRowPanel.Items.Add(this.btn20); //base.Items.Add(this.btn20); //this.btn10 = new btnTransparencyPercent("10%", 10, (RibbonToolTip)base.get_ToolTip()); //ribbonRowPanel.Items.Add(this.btn10); //base.Items.Add(this.btn10); //this.btn0 = new btnTransparencyPercent("0%", 0, (RibbonToolTip)base.get_ToolTip()); //ribbonRowPanel.Items.Add(this.btn0); //base.Items.Add(this.btn0); this.name = AfaStrings.RBN_BTN_TRANSPARENCY; this.tooltipTitle = AfaStrings.RBN_BTN_TRANSPARENCY_TOOLTIP_TITLE; this.tooltipDescr = AfaStrings.RBN_BTN_TRANSPARENCY_TOOLTIP; this.smallImageName = "img_transparency_small"; this.largeImageName = "img_transparency_large"; this.orientation = Orientation.Vertical; base.Id = this.name; base.Name = this.name; base.Text = this.name; base.IsEnabled = true; base.DropDownOpened += new EventHandler <EventArgs>(this.btnTransparency_DropDownOpened); base.Image = ArcGISRibbon.loadImage(this.smallImageName); base.LargeImage = ArcGISRibbon.loadImage(this.largeImageName); base.Size = this.btnsize; base.ShowImage = true; base.ShowText = false; base.Orientation = this.orientation; base.KeyTip = "This is a keytip"; base.ToolTip = ArcGISRibbon.createToolTip(this.tooltipTitle, this.tooltipDescr); base.CommandHandler = (new btn_TransparencyCommandHandler()); base.HelpSource = ArcGISRibbon.HelpPath; base.ListButtonStyle = RibbonListButtonStyle.SplitButton; RibbonRowPanel panel = new RibbonRowPanel { GroupName = AfaStrings.RBN_BTN_TRANSPARENCY }; this.btn100 = new btnTransparencyPercent("100%", 100, (RibbonToolTip)base.ToolTip); panel.Items.Add(this.btn100); base.Items.Add(this.btn100); this.btn90 = new btnTransparencyPercent("90%", 90, (RibbonToolTip)base.ToolTip); panel.Items.Add(this.btn90); base.Items.Add(this.btn90); this.btn80 = new btnTransparencyPercent("80%", 80, (RibbonToolTip)base.ToolTip); panel.Items.Add(this.btn80); base.Items.Add(this.btn80); this.btn70 = new btnTransparencyPercent("70%", 70, (RibbonToolTip)base.ToolTip); panel.Items.Add(this.btn70); base.Items.Add(this.btn70); this.btn60 = new btnTransparencyPercent("60%", 60, (RibbonToolTip)base.ToolTip); panel.Items.Add(this.btn60); base.Items.Add(this.btn60); this.btn50 = new btnTransparencyPercent("50%", 50, (RibbonToolTip)base.ToolTip); panel.Items.Add(this.btn50); base.Items.Add(this.btn50); this.btn40 = new btnTransparencyPercent("40%", 40, (RibbonToolTip)base.ToolTip); panel.Items.Add(this.btn40); base.Items.Add(this.btn40); this.btn30 = new btnTransparencyPercent("30%", 30, (RibbonToolTip)base.ToolTip); panel.Items.Add(this.btn30); base.Items.Add(this.btn30); this.btn20 = new btnTransparencyPercent("20%", 20, (RibbonToolTip)base.ToolTip); panel.Items.Add(this.btn20); base.Items.Add(this.btn20); this.btn10 = new btnTransparencyPercent("10%", 10, (RibbonToolTip)base.ToolTip); panel.Items.Add(this.btn10); base.Items.Add(this.btn10); this.btn0 = new btnTransparencyPercent("0%", 0, (RibbonToolTip)base.ToolTip); panel.Items.Add(this.btn0); base.Items.Add(this.btn0); }
public void SetChildIndex(RibbonButton child, int newIndex) { base.SetChildIndex(child, newIndex); FireCollectionChanged(); }
private void CreateRibbon() { { RibbonButtonTab tab = new RibbonButtonTab(); tab.Name = "Start"; tab.DropDown = new RibbonDropDownMenu(this.Ribbon) { Menu = CreateStartMenu() }; this.Ribbon.Tabs.Add(tab); } { RibbonTab tab = new RibbonTab(); tab.Name = "Home"; this.Ribbon.Tabs.Add(tab); { RibbonControlGroup group = new RibbonControlGroup(); group.Name = "Script"; tab.TabPanel.Groups.Add(group); { RibbonControlGroupPanel panel = new RibbonControlGroupPanel(); panel.Policy = RibbonControlSizingPolicy.Big; group.Panels.Add(panel); { RibbonButton button = new RibbonButton(); button.BigImage = TurtleIdeRibbon.New; button.SmallImage = TurtleIdeRibbon.New; button.Name = "New"; button.Executed += (s, e) => this.content.OperationNew(); panel.ControlItems.Add(button); } } { RibbonControlGroupPanel panel = new RibbonControlGroupPanel(); panel.Policy = RibbonControlSizingPolicy.BigSmall; group.Panels.Add(panel); { RibbonButton button = new RibbonButton(); button.ButtonStyle = RibbonButtonStyle.SplitButton; button.BigImage = TurtleIdeRibbon.Open; button.SmallImage = TurtleIdeRibbon.Open; button.Name = "Open"; button.DropDown = CreateOpenMenu(this.Ribbon); button.Executed += (s, e) => this.content.OperationOpen(); panel.ControlItems.Add(button); } { RibbonButton button = new RibbonButton(); button.BigImage = TurtleIdeRibbon.Save; button.SmallImage = TurtleIdeRibbon.Save; button.Name = "Save"; button.Executed += (s, e) => this.content.OperationSave(); panel.ControlItems.Add(button); } { RibbonButton button = new RibbonButton(); button.BigImage = TurtleIdeRibbon.SaveAs; button.SmallImage = TurtleIdeRibbon.SaveAs; button.Name = "Save As"; button.Executed += (s, e) => this.content.OperationSaveAs(); panel.ControlItems.Add(button); } } } { RibbonControlGroup group = new RibbonControlGroup(); group.Name = "Clipboard"; tab.TabPanel.Groups.Add(group); { RibbonControlGroupPanel panel = new RibbonControlGroupPanel(); panel.Policy = RibbonControlSizingPolicy.BigSmall; group.Panels.Add(panel); { RibbonButton button = this.buttonCut = new RibbonButton(); button.BigImage = TurtleIdeRibbon.Cut; button.SmallImage = TurtleIdeRibbon.Cut; button.Name = "Cut"; button.Executed += (s, e) => this.content.OperationCut(); panel.ControlItems.Add(button); } { RibbonButton button = this.buttonCopy = new RibbonButton(); button.BigImage = TurtleIdeRibbon.Copy; button.SmallImage = TurtleIdeRibbon.Copy; button.Name = "Copy"; button.Executed += (s, e) => this.content.OperationCopy(); panel.ControlItems.Add(button); } { RibbonButton button = this.buttonPaste = new RibbonButton(); button.BigImage = TurtleIdeRibbon.Paste; button.SmallImage = TurtleIdeRibbon.Paste; button.Name = "Paste"; button.Executed += (s, e) => this.content.OperationPaste(); panel.ControlItems.Add(button); } } } { RibbonButtonGroup group = new RibbonButtonGroup(); group.Name = "Edit"; tab.TabPanel.Groups.Add(group); { RibbonButton button = this.buttonUndo = new RibbonButton(); button.BigImage = TurtleIdeRibbon.Undo; button.Name = "Undo"; button.Executed += (s, e) => this.content.OperationUndo(); group.BigItems.Add(button); } { RibbonButton button = this.buttonRedo = new RibbonButton(); button.BigImage = TurtleIdeRibbon.Redo; button.Name = "Redo"; button.Executed += (s, e) => this.content.OperationRedo(); group.BigItems.Add(button); } } { RibbonButtonGroup group = new RibbonButtonGroup(); group.Name = "Debug"; tab.TabPanel.Groups.Add(group); { RibbonButton button = this.buttonRun = new RibbonButton(); button.BigImage = TurtleIdeRibbon.Run; button.Name = "Run"; button.Executed += (s, e) => this.content.OperationRun(); group.BigItems.Add(button); } { RibbonButton button = this.buttonStop = new RibbonButton(); button.BigImage = TurtleIdeRibbon.Stop; button.Name = "Stop"; button.Executed += (s, e) => this.content.OperationStop(); group.BigItems.Add(button); } } } UpdateRibbon(false); }
public static bool AddRibbon() { RibbonControl rc = ComponentManager.Ribbon; string tabId = "MyTools"; var tabs = rc.Tabs.Select(d => d.Id).ToList(); if (tabs.Contains(tabId)) { var tab = rc.Tabs.FirstOrDefault(d => d.Id == tabId); rc.Tabs.Remove(tab); } try { RibbonTab rt = new RibbonTab { Title = "我的工具", Id = tabId, IsActive = true }; rc.Tabs.Add(rt); RibbonPanel rp = new RibbonPanel(); rt.Panels.Add(rp); RibbonPanelSource rps = new RibbonPanelSource(); rps.Title = "车位工具"; rp.Source = rps; string btnName = "添加车位"; RibbonButton rb = new RibbonButton { Name = btnName, Text = btnName, ShowText = true, Image = Properties.Resources.AddCar.GetBitmapImage(16), LargeImage = Properties.Resources.AddCar.GetBitmapImage(32), Orientation = System.Windows.Controls.Orientation.Vertical, CommandHandler = new RibbonCommandHandler(), CommandParameter = "AddCar", Size = RibbonItemSize.Large }; rps.Items.Add(rb); RibbonToolTip rtt = new RibbonToolTip { Title = "添加车位", Content = "添加车位的功能", Command = "AddCar", ExpandedContent = "添加车位,排序及统计", ExpandedImage = Properties.Resources.AddCarToolTip.GetBitmapImage(), }; rb.ToolTip = rtt; return(true); } catch { return(false); } }
private void BindShortkey() { foreach (var child in Toolbar.Children) { if (child.GetType() == typeof(StackPanel)) { foreach (var subchild in ((StackPanel)child).Children) { if (subchild.GetType() == typeof(RibbonButton)) { RibbonButton btl = (RibbonButton)subchild; KeyBinding key = new KeyBinding(); if (btl.Name.Equals("tlbAdd")) { KeyGesture keyg = new KeyGesture(Key.N, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.AddCommand, keyg); key.Gesture = keyg; } else if (btl.Name.Equals("tlbModify")) { KeyGesture keyg = new KeyGesture(Key.M, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.ModifyCommand, keyg); } else if (btl.Name.Equals("tlbDelete")) { KeyGesture keyg = new KeyGesture(Key.Delete, ModifierKeys.None); key = new KeyBinding(ucPhanBoTheoLichCT.DeleteCommand, keyg); } else if (btl.Name.Equals("tlbApprove")) { KeyGesture keyg = new KeyGesture(Key.D, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.ApproveCommand, keyg); } else if (btl.Name.Equals("tlbRefuse")) { KeyGesture keyg = new KeyGesture(Key.R, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.RefuseCommand, keyg); } else if (btl.Name.Equals("tlbCancel")) { KeyGesture keyg = new KeyGesture(Key.I, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.CancelCommand, keyg); } else if (btl.Name.Equals("tlbSearch")) { KeyGesture keyg = new KeyGesture(Key.F, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.SearchCommand, keyg); } else if (btl.Name.Equals("tlbExport")) { KeyGesture keyg = new KeyGesture(Key.E, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.ExportCommand, keyg); } else if (btl.Name.Equals("tlbClose")) { KeyGesture keyg = new KeyGesture(Key.Escape, ModifierKeys.None); key = new KeyBinding(ucPhanBoTheoLichCT.CloseCommand, keyg); } InputBindings.Add(key); } } } if (child.GetType() == typeof(RibbonButton)) { RibbonButton btl = (RibbonButton)child; KeyBinding key = new KeyBinding(); if (btl.Name.Equals("tlbAdd")) { KeyGesture keyg = new KeyGesture(Key.N, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.AddCommand, keyg); key.Gesture = keyg; } else if (btl.Name.Equals("tlbModify")) { KeyGesture keyg = new KeyGesture(Key.M, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.ModifyCommand, keyg); } else if (btl.Name.Equals("tlbRemove")) { KeyGesture keyg = new KeyGesture(Key.Delete, ModifierKeys.None); key = new KeyBinding(ucPhanBoTheoLichCT.DeleteCommand, keyg); } else if (btl.Name.Equals("tlbApprove")) { KeyGesture keyg = new KeyGesture(Key.D, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.ApproveCommand, keyg); } else if (btl.Name.Equals("tlbRefuse")) { KeyGesture keyg = new KeyGesture(Key.R, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.RefuseCommand, keyg); } else if (btl.Name.Equals("tlbCancel")) { KeyGesture keyg = new KeyGesture(Key.I, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.CancelCommand, keyg); } else if (btl.Name.Equals("tlbSearch")) { KeyGesture keyg = new KeyGesture(Key.F, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.SearchCommand, keyg); } else if (btl.Name.Equals("tlbExport")) { KeyGesture keyg = new KeyGesture(Key.E, ModifierKeys.Control); key = new KeyBinding(ucPhanBoTheoLichCT.ExportCommand, keyg); } else if (btl.Name.Equals("tlbClose")) { KeyGesture keyg = new KeyGesture(Key.Escape, ModifierKeys.None); key = new KeyBinding(ucPhanBoTheoLichCT.CloseCommand, keyg); } InputBindings.Add(key); } } }
/// <summary> /// Draws a SplitDropDown button in normal state /// </summary> /// <param name="e"></param> /// <param name="button"></param> public void DrawSplitButton(RibbonItemRenderEventArgs e, RibbonButton button) { }
/// <summary> /// 初始化用户界面 /// </summary> private void InitializeUI() { #region 根据XML配置文件生成Ribbon MainRibbonConfigXML mainRibbonCfg = new MainRibbonConfigXML(); MainRibbonDef mainRibbonDef = mainRibbonCfg.CreateMainRibbonDef(); Ribbon mainRibbon = new Ribbon(); //mainRibbon.Height = 200; mainRibbon.SetValue(Grid.RowProperty, 0); mainRibbon.SetValue(Grid.ColumnProperty, 0); mainRibbon.SetValue(Grid.ColumnSpanProperty, 4); foreach (MainRibbonTabDef tabDef in mainRibbonDef.RibbonTabs) { RibbonTab ribbonTab = new RibbonTab() { Header = tabDef.Header }; mainRibbon.Items.Add(ribbonTab); //ribbonTab.Margin = new Thickness(0, 0, 0, -125); foreach (MainRibbonGroupDef groupDef in tabDef.RibbonGroups) { RibbonGroup ribbonGroup = new RibbonGroup() { Header = groupDef.Header }; ribbonTab.Items.Add(ribbonGroup); //ribbonGroup.Margin = new Thickness(0, 0, 0, -100); foreach (MainRibbonComponentDef comDef in groupDef.RibbonComponents) { IDsPlugin plugin = GetPluginByNameSapce(comDef.NameSpace); if (plugin != null) { if (plugin is IDsCommand) { IDsCommand cmd = plugin as IDsCommand; cmd.OnCreate(m_application); RibbonButton rbtn = new RibbonButton(); rbtn.Label = comDef.Label; rbtn.Tag = cmd; if (comDef.width > 0) { rbtn.Width = comDef.width; } switch (comDef.ImageType) { case ImageType.itSmall: rbtn.SmallImageSource = CreateBitmapImageSource(cmd.SmallBitmap); break; case ImageType.itLarge: rbtn.LargeImageSource = CreateBitmapImageSource(cmd.LargeBitmap); break; default: break; } rbtn.Click += delegate(object sender, RoutedEventArgs e) { (rbtn.Tag as IDsCommand).OnActivate(); }; ribbonGroup.Items.Add(rbtn); } else if (plugin is IDsTool) { IDsTool tool = plugin as IDsTool; tool.OnCreate(m_application); RibbonButton rbtn = new RibbonButton(); rbtn.Label = comDef.Label; rbtn.Tag = tool; if (comDef.width > 0) { rbtn.Width = comDef.width; } switch (comDef.ImageType) { case ImageType.itSmall: rbtn.SmallImageSource = CreateBitmapImageSource(tool.SmallBitmap); break; case ImageType.itLarge: rbtn.LargeImageSource = CreateBitmapImageSource(tool.LargeBitmap); break; default: break; } rbtn.Click += delegate(object sender, RoutedEventArgs e) { (rbtn.Tag as IDsTool).OnActivate(); }; ribbonGroup.Items.Add(rbtn); } else if (plugin is IDsPanel) { IDsPanel pluginPnl = plugin as IDsPanel; pluginPnl.OnCreate(m_application); ribbonGroup.Items.Add(pluginPnl.PluginPanel); } } } } } mainRibbon.Items.Add(CreateTestStyleTab()); mainGrid.Children.Add(mainRibbon); #endregion #region GIS Controls GISControlsConfigXML gisCtrlsCfg = new GISControlsConfigXML(); GISControlsDef gisCtrlsDef = gisCtrlsCfg.CreateGISControlsDef(); if (gisCtrlsDef != null && m_gisCtrls != null) { IEnumerable <IDsGISControls> items = from g in m_gisCtrls where g.ToString() == gisCtrlsDef.NameSpace select g; if (items.Count() > 0) { IDsGISControls gisCtrls = items.First(); if (gisCtrls != null) { gisCtrls.InitializeControls(m_application); #region 在左停靠面板放置图例控件 LayoutAnchorable legendLayoutAnchor = new LayoutAnchorable(); legendLayoutAnchor.ContentId = ""; legendLayoutAnchor.Content = gisCtrls.LegendControl; legendLayoutAnchor.Title = "图层列表"; //隐藏状态下宽度 = 容器的宽度 legendLayoutAnchor.AutoHideWidth = anchorGrpLeft.DockWidth.Value - 20; //不能关闭 legendLayoutAnchor.CanHide = false; legendLayoutAnchor.CanClose = false; //可以浮动 legendLayoutAnchor.CanFloat = true; //可以隐藏 legendLayoutAnchor.CanAutoHide = true; //触发自动隐藏,需放到界面放入容器后调用 //legendLayoutAnchor.ToggleAutoHide(); anchorPaneLeft.Children.Add(legendLayoutAnchor); #endregion #region 在主停靠面板放置地图控件 LayoutDocument mapLayoutDoc = new LayoutDocument(); mapLayoutDoc.Title = "地图"; mapLayoutDoc.ContentId = ""; mapLayoutDoc.Content = gisCtrls.MapControl; mapLayoutDoc.CanClose = false; mapLayoutDoc.CanFloat = false; docPaneMain.Children.Add(mapLayoutDoc); #endregion m_application.LegendControl = gisCtrls.LegendControlCore; m_application.MapControl = gisCtrls.MapControlCore; } } } #endregion #region DsApplication Controls m_application.RightDockPanel = anchorPaneRight; m_application.LeftDockPanel = anchorPaneLeft; m_application.MainDockRoot = dockLayoutRoot; m_application.MainDockPanel = docPaneMain; //test #endregion }
/// <summary> /// Draws a SplitDropDown button with the dropdown area selected /// </summary> /// <param name="e"></param> /// <param name="button"></param> public void DrawSplitButtonDropDownSelected(RibbonItemRenderEventArgs e, RibbonButton button) { Rectangle outerR = Rectangle.FromLTRB( button.DropDownBounds.Left, button.DropDownBounds.Top, button.DropDownBounds.Right - 1, button.DropDownBounds.Bottom - 1); Rectangle innerR = Rectangle.FromLTRB( outerR.Left + 1, outerR.Top + (button.SizeMode == RibbonElementSizeMode.Large ? 1 : 0), outerR.Right - 1, outerR.Bottom - 1); Rectangle faceOuterR = Rectangle.FromLTRB( button.ButtonFaceBounds.Left, button.ButtonFaceBounds.Top, button.ButtonFaceBounds.Right - 1, button.ButtonFaceBounds.Bottom - 1); Rectangle faceInnerR = Rectangle.FromLTRB( faceOuterR.Left + 1, faceOuterR.Top + 1, faceOuterR.Right + (button.SizeMode == RibbonElementSizeMode.Large ? -1 : 0), faceOuterR.Bottom + (button.SizeMode == RibbonElementSizeMode.Large ? 0 : -1)); Corners faceCorners = ButtonFaceRounding(button); Corners ddCorners = ButtonDdRounding(button); GraphicsPath outer = RoundRectangle(outerR, 3, ddCorners); GraphicsPath inner = RoundRectangle(innerR, 2, ddCorners); GraphicsPath faceOuter = RoundRectangle(faceOuterR, 3, faceCorners); GraphicsPath faceInner = RoundRectangle(faceInnerR, 2, faceCorners); using (SolidBrush b = new SolidBrush(Color.FromArgb(150, Color.White))) { e.Graphics.FillPath(b, faceInner); } using (Pen p = new Pen(button.Pressed && button.SizeMode != RibbonElementSizeMode.DropDown ? ColorTable.ButtonPressedBorderIn : ColorTable.ButtonSelectedBorderIn)) { e.Graphics.DrawPath(p, faceInner); } using (Pen p = new Pen(button.Pressed && button.SizeMode != RibbonElementSizeMode.DropDown ? ColorTable.ButtonPressedBorderOut : ColorTable.ButtonSelectedBorderOut)) { e.Graphics.DrawPath(p, faceOuter); } outer.Dispose(); inner.Dispose(); faceOuter.Dispose(); faceInner.Dispose(); }
private void BindShortkey() { foreach (var child in Toolbar.Children) { if (child.GetType() == typeof(RibbonButton)) { RibbonButton tlb = (RibbonButton)child; KeyBinding key = new KeyBinding(); string strTinhNang = tlb.Name.Substring(3, tlb.Name.Length - 3); if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.LUU_TAM))) { KeyGesture keyg = new KeyGesture(Key.H, ModifierKeys.Control); key = new KeyBinding(HoldCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TRINH_DUYET))) { KeyGesture keyg = new KeyGesture(Key.S, ModifierKeys.Control); key = new KeyBinding(SaveCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.SUA))) { KeyGesture keyg = new KeyGesture(Key.M, ModifierKeys.Control); key = new KeyBinding(ModifyCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XOA))) { KeyGesture keyg = new KeyGesture(Key.Delete, ModifierKeys.Shift); key = new KeyBinding(DeleteCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.DUYET))) { KeyGesture keyg = new KeyGesture(Key.A, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(ApproveCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TU_CHOI_DUYET))) { KeyGesture keyg = new KeyGesture(Key.R, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(RefuseCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.THOAI_DUYET))) { KeyGesture keyg = new KeyGesture(Key.C, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(CancelCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TINH_TOAN))) { KeyGesture keyg = new KeyGesture(Key.T, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(CancelCommand, keyg); } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TRO_GIUP))) { KeyGesture keyg = new KeyGesture(Key.F1, ModifierKeys.None); key = new KeyBinding(HelpCommand, keyg); } if (key != null) { InputBindings.Add(key); } } } }
public RibbonBar AddButton(RibbonButton button) { Buttons.Add(button); return this; }
public void Add(RibbonButton value) { base.Add(value); FireCollectionChanged(); }
private void ButtonOnClick(object sender, RoutedEventArgs e) { RibbonButton btn = (RibbonButton)sender; if (ActiveButton != null) { SetButtonFocus(ActiveButton, MyColorConverter.convertToSolidColor("#E0E0E0"), 0); } if (btn == btnLineTool) { ActiveButton = btnLineTool; } else if (btn == btnArrowTool) { ActiveButton = btnArrowTool; } else if (btn == btnRectangleTool) { ActiveButton = btnRectangleTool; } else if (btn == btnEllipseTool) { ActiveButton = btnEllipseTool; } else if (btn == btnStar) { ActiveButton = btnStar; } else if (btn == btnSelect) { ActiveButton = btnSelect; } else if (btn == btnInsertText) { ActiveButton = btnInsertText; } else if (btn == btnBoldText) { ActiveButton = btnBoldText; } else if (btn == btnItalicText) { ActiveButton = btnItalicText; } else if (btn == btnUnderlineText) { ActiveButton = btnUnderlineText; } else if (btn == btnStrokeColor) { ActiveButton = btnStrokeColor; } else if (btn == btnFillColor) { ActiveButton = btnFillColor; } if (ActiveButton != null) { SetButtonFocus(ActiveButton, MyColorConverter.convertToSolidColor("#90CAF9"), 0.5); } }
public int GetChildIndex(RibbonButton child, bool throwException) { return(base.GetChildIndex(child, throwException)); }
/// <summary> /// To change the font style value of the annotation /// </summary> /// <param name="parameter">Command parameter</param> private void OnSelectFontStyleCommandExecute(object parameter) { RibbonButton button = parameter as RibbonButton; string fontStyleName = button.Name.ToString(); if (fontStyleName.Equals("bold")) { foreach (NodeViewModel node in (this.SelectedItems as SelectorViewModel).Nodes as IEnumerable <object> ) { foreach (IAnnotation annotation in node.Annotations as ObservableCollection <IAnnotation> ) { if ((annotation as TextAnnotationViewModel).FontWeight == FontWeights.Bold) { (annotation as TextAnnotationViewModel).FontWeight = FontWeights.Normal; button.Background = new SolidColorBrush(Colors.Transparent); } else { (annotation as TextAnnotationViewModel).FontWeight = FontWeights.Bold; button.Background = new SolidColorBrush(Colors.LightBlue); } } } foreach (ConnectorViewModel conn in (this.SelectedItems as SelectorViewModel).Connectors as IEnumerable <object> ) { foreach (IAnnotation annotation in conn.Annotations as ObservableCollection <IAnnotation> ) { if ((annotation as TextAnnotationViewModel).FontWeight == FontWeights.Bold) { (annotation as TextAnnotationViewModel).FontWeight = FontWeights.Normal; button.Background = new SolidColorBrush(Colors.Transparent); } else { (annotation as TextAnnotationViewModel).FontWeight = FontWeights.Bold; button.Background = new SolidColorBrush(Colors.LightBlue); } } } } else if (fontStyleName.Equals("italic")) { foreach (NodeViewModel node in (this.SelectedItems as SelectorViewModel).Nodes as IEnumerable <object> ) { foreach (IAnnotation annotation in node.Annotations as ObservableCollection <IAnnotation> ) { if ((annotation as TextAnnotationViewModel).FontStyle == FontStyles.Italic) { (annotation as TextAnnotationViewModel).FontStyle = FontStyles.Normal; button.Background = new SolidColorBrush(Colors.Transparent); } else { (annotation as TextAnnotationViewModel).FontStyle = FontStyles.Italic; button.Background = new SolidColorBrush(Colors.LightBlue); } } } foreach (ConnectorViewModel conn in (this.SelectedItems as SelectorViewModel).Connectors as IEnumerable <object> ) { foreach (IAnnotation annotation in conn.Annotations as ObservableCollection <IAnnotation> ) { if ((annotation as TextAnnotationViewModel).FontStyle == FontStyles.Italic) { (annotation as TextAnnotationViewModel).FontStyle = FontStyles.Normal; button.Background = new SolidColorBrush(Colors.Transparent); } else { (annotation as TextAnnotationViewModel).FontStyle = FontStyles.Italic; button.Background = new SolidColorBrush(Colors.LightBlue); } } } } else if (fontStyleName.Equals("underline")) { if (underLineFlag) { button.Background = new SolidColorBrush(Colors.Transparent); underLineFlag = false; } else { button.Background = new SolidColorBrush(Colors.LightBlue); underLineFlag = true; } this.OnUnderLineChanged(underLineFlag); } else if (fontStyleName.Equals("Strike")) { if (strikeFlag) { button.Background = new SolidColorBrush(Colors.Transparent); strikeFlag = false; } else { button.Background = new SolidColorBrush(Colors.LightBlue); strikeFlag = true; } this.OnStrikeChanged(strikeFlag); } }
public void Remove(RibbonButton value) { base.Remove(value); FireCollectionChanged(); }
private void InitLists() { Image[] images = new Image[255]; BackColor = ribbon1.Theme.RendererColorTable.RibbonBackground; Random r = new Random(); #region Color Squares using (GraphicsPath path = RibbonProfessionalRenderer.RoundRectangle(new Rectangle(3, 3, 26, 26), 4)) { using (GraphicsPath outer = RibbonProfessionalRenderer.RoundRectangle(new Rectangle(0, 0, 32, 32), 4)) { for (int i = 0; i < images.Length; i++) { Bitmap b = new Bitmap(32, 32); using (Graphics g = Graphics.FromImage(b)) { g.SmoothingMode = SmoothingMode.AntiAlias; using (SolidBrush br = new SolidBrush(Color.FromArgb(255, i * (255 / images.Length), 0))) { g.FillPath(br, path); } using (Pen p = new Pen(Color.White, 3)) { g.DrawPath(p, path); } g.DrawPath(Pens.Wheat, path); g.DrawString(Convert.ToString(i + 1), Font, Brushes.White, new Point(10, 10)); g.SmoothingMode = SmoothingMode.Default; } images[i] = b; RibbonButton btn = new RibbonButton(); btn.Image = b; lst.Buttons.Add(btn); } } } //lst.DropDownItems.Add(new RibbonSeparator("Available styles")); RibbonButtonList lst2 = new RibbonButtonList(); for (int i = 0; i < images.Length; i++) { RibbonButton btn = new RibbonButton(); btn.Image = images[i]; lst2.Buttons.Add(btn); } lst.DropDownItems.Add(lst2); lst.DropDownItems.Add(new RibbonButton("Save selection as a new quick style...")); lst.DropDownItems.Add(new RibbonButton("Erase Format")); lst.DropDownItems.Add(new RibbonButton("Apply style...")); #endregion #region Theme Colors RibbonButton[] buttons = new RibbonButton[30]; int square = 16; int squares = 4; int sqspace = 2; for (int i = 0; i < buttons.Length; i++) { #region Create color squares Bitmap colors = new Bitmap((square + sqspace) * squares, square + 1); string[] colorss = new string[squares]; using (Graphics g = Graphics.FromImage(colors)) { for (int j = 0; j < 4; j++) { Color sqcolor = GetRandomColor(r); colorss[j] = sqcolor.Name; using (SolidBrush b = new SolidBrush(sqcolor)) { g.FillRectangle(b, new Rectangle(j * (square + sqspace), 0, square, square)); } g.DrawRectangle(Pens.Gray, new Rectangle(j * (square + sqspace), 0, square, square)); } } #endregion buttons[i] = new RibbonButton(colors); buttons[i].Text = string.Join(", ", colorss);; buttons[i].MaxSizeMode = RibbonElementSizeMode.Medium; buttons[i].MinSizeMode = RibbonElementSizeMode.Medium; } RibbonButtonList blst = new RibbonButtonList(buttons); blst.FlowToBottom = false; blst.ItemsSizeInDropwDownMode = new Size(1, 10); itemColors.DropDownItems.Insert(0, blst); itemColors.DropDownResizable = true; #endregion }
private void tlbShortcutKey_Click(object sender, RoutedEventArgs e) { RibbonButton tlb = (RibbonButton)sender; MessageBox.Show(tlb.Label + " OK"); }
private void BindHotkey() { foreach (var child in Toolbar.Children) { if (child.GetType() == typeof(RibbonButton)) { RibbonButton tlb = (RibbonButton)child; KeyBinding key = new KeyBinding(); string strTinhNang = tlb.Name.Substring(3, tlb.Name.Length - 3); if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.THEM))) { KeyGesture keyg = new KeyGesture(Key.N, ModifierKeys.Control); key = new KeyBinding(AddCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.SUA))) { KeyGesture keyg = new KeyGesture(Key.M, ModifierKeys.Control); key = new KeyBinding(ModifyCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XOA))) { KeyGesture keyg = new KeyGesture(Key.D, ModifierKeys.Control); key = new KeyBinding(DeleteCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.DUYET))) { KeyGesture keyg = new KeyGesture(Key.A, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(ApproveCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TU_CHOI_DUYET))) { KeyGesture keyg = new KeyGesture(Key.R, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(RefuseCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.THOAI_DUYET))) { KeyGesture keyg = new KeyGesture(Key.C, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(CancelCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XEM))) { KeyGesture keyg = new KeyGesture(Key.W, ModifierKeys.Control); key = new KeyBinding(ViewCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TIM_KIEM))) { KeyGesture keyg = new KeyGesture(Key.F, ModifierKeys.Control); key = new KeyBinding(SearchCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.LAY_LAI))) { KeyGesture keyg = new KeyGesture(Key.F5, ModifierKeys.None); key = new KeyBinding(ReloadCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.XUAT_DU_LIEU))) { KeyGesture keyg = new KeyGesture(Key.E, ModifierKeys.Control | ModifierKeys.Shift); key = new KeyBinding(ExportCommand, keyg); key.Gesture = keyg; } else if (strTinhNang.Equals(DatabaseConstant.getValue(DatabaseConstant.Action.TRO_GIUP))) { KeyGesture keyg = new KeyGesture(Key.F1, ModifierKeys.None); key = new KeyBinding(HelpCommand, keyg); key.Gesture = keyg; } if (key != null) { InputBindings.Add(key); } } } }
public View(ViewType viewtype, string strTitle, ViewsManager views, object objArgument) { this.Name = viewtype.Name; this.Panel1MinSize = 0; this.Panel2MinSize = 0; ////////////////////////////////////////////////////////////////////////// _viewtype = viewtype; _views = views; this.Argument = objArgument; _helpOpened = false; ////////////////////////////////////////////////////////////////////////// this.BorderStyle = BorderStyle.Fixed3D; this.Left = _views.Ribbon.Left; this.Top = _views.Ribbon.Bottom; this.Width = _views.Ribbon.Width; this.Height = (_views.MainForm.Height - this.Top) - 38; this.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom; this.BackColor = MainForm.ColorBackground; ////////////////////////////////////////////////////////////////////////// _views.MainForm.Controls.Add(this); _tab = new RibbonTab { Text = strTitle, Tag = this }; RibbonPanel panelGeneral = new RibbonPanel("General"); _tab.Panels.Add(panelGeneral); InitViewCommands(panelGeneral); InitViewPanes(_tab); ////////////////////////////////////////////////////////////////////////// RibbonPanel panelMisc = new RibbonPanel("Misc"); _tab.Panels.Add(panelMisc); RibbonButton btnCloseView = new RibbonButton("Close View"); panelMisc.Items.Add(btnCloseView); btnCloseView.Image = Properties.Resources.CloseView; btnCloseView.SmallImage = Properties.Resources.CloseView; btnCloseView.Click += new EventHandler(_views.OnCloseView_Clicked); btnCloseView.MouseEnter += _views.MainForm.RibbonButton_MouseEnter; ////////////////////////////////////////////////////////////////////////// //RibbonButton btnHelp = new RibbonButton("RegExp Help"); //btnHelp.Image = Properties.Resources.HelpIcon; //btnHelp.Click += btnHelp_Click; //RibbonPanel helpGeneral = new RibbonPanel("Help"); //helpGeneral.Items.Add(btnHelp); //tab.Panels.Add(helpGeneral); _views.Ribbon.Tabs.Add(_tab); _views.Ribbon.ActiveTab = _tab; }
private void InitializeRibbon() { Ribbon ribbon = new Ribbon(); RibbonTab ribbonTab = new RibbonTab(); ribbonTab.Header = "地图浏览"; RibbonGroup ribbonGroup = new RibbonGroup(); ribbonGroup.Header = "三维"; RibbonButton rbtn = new RibbonButton(); rbtn.Label = "三维飞行"; Bitmap bmp = new Bitmap(string.Format("{0}\\images\\3DFlyAlong32.png", System.Windows.Forms.Application.StartupPath)); IntPtr ptr = bmp.GetHbitmap(); rbtn.LargeImageSource = Imaging.CreateBitmapSourceFromHBitmap(ptr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); ribbonGroup.Items.Add(rbtn); ribbonTab.Items.Add(ribbonGroup); ribbonGroup = new RibbonGroup(); ribbonGroup.Header = "属性查询"; ribbonGroup.Width = 80; RibbonTextBox rtb = new RibbonTextBox(); rtb.Style = FindResource("RoundCornerRibbonTextBoxStyle") as Style; rtb.Width = 60; ribbonGroup.Items.Add(rtb); rtb = new RibbonTextBox(); rtb.Width = 60; ribbonGroup.Items.Add(rtb); ribbonTab.Items.Add(ribbonGroup); ribbon.Items.Add(ribbonTab); #region 根据插件创建控件UI RibbonTab pluginTab = new RibbonTab(); pluginTab.Header = "插件测试"; RibbonGroup pluginGroup = new RibbonGroup(); pluginGroup.Header = "插件测试"; RibbonButton pluginBtn = new RibbonButton(); pluginBtn.Label = "三维飞行"; Bitmap pluginBmp = new Bitmap(string.Format("{0}\\images\\3DFlyAlong32.png", System.Windows.Forms.Application.StartupPath)); IntPtr pluginPtr = pluginBmp.GetHbitmap(); pluginBtn.LargeImageSource = Imaging.CreateBitmapSourceFromHBitmap(pluginPtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); pluginGroup.Items.Add(pluginBtn); pluginTab.Items.Add(pluginGroup); ribbon.Items.Add(pluginTab); #endregion mainGrid.Children.Add(ribbon); DeleteObject(ptr); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.OuterPanel = new System.Windows.Forms.Panel(); this.ribbonProgress = new System.Windows.Forms.Panel(); this.lblProgress = new System.Windows.Forms.Label(); this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.picBoxZoom = new Genetibase.NuGenMediImage.UI.Controls.RibbonItem(); this.picBoxMain = new Genetibase.NuGenMediImage.UI.Controls.CustomPictureBox(); this.picBoxAdjustments = new Genetibase.NuGenMediImage.UI.Controls.CustomPictureBox(); this.btnDone = new Genetibase.NuGenMediImage.UI.Controls.RibbonButton(); this.textBoxMainPanel = new Genetibase.NuGenMediImage.UI.Controls.ThemedPanel(); this.txtBoxMain = new System.Windows.Forms.RichTextBox(); this.OuterPanel.SuspendLayout(); this.ribbonProgress.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picBoxZoom)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picBoxMain)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picBoxAdjustments)).BeginInit(); this.textBoxMainPanel.SuspendLayout(); this.SuspendLayout(); // // OuterPanel // this.OuterPanel.Controls.Add(this.ribbonProgress); this.OuterPanel.Controls.Add(this.picBoxMain); this.OuterPanel.Controls.Add(this.picBoxAdjustments); this.OuterPanel.Controls.Add(this.btnDone); this.OuterPanel.Controls.Add(this.textBoxMainPanel); this.OuterPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.OuterPanel.Location = new System.Drawing.Point(0, 0); this.OuterPanel.Name = "OuterPanel"; this.OuterPanel.Size = new System.Drawing.Size(416, 328); this.OuterPanel.TabIndex = 5; this.OuterPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.txtBoxMain_MouseDown); this.OuterPanel.SizeChanged += new System.EventHandler(this.OuterPanel_SizeChanged); // // ribbonProgress // this.ribbonProgress.BackColor = System.Drawing.Color.Gray; this.ribbonProgress.Controls.Add(this.lblProgress); this.ribbonProgress.Controls.Add(this.progressBar1); this.ribbonProgress.Location = new System.Drawing.Point(6, 6); this.ribbonProgress.Name = "ribbonProgress"; this.ribbonProgress.Size = new System.Drawing.Size(259, 42); this.ribbonProgress.TabIndex = 11; this.ribbonProgress.Visible = false; // // lblProgress // this.lblProgress.AutoSize = true; this.lblProgress.BackColor = System.Drawing.Color.Transparent; this.lblProgress.ForeColor = System.Drawing.Color.Black; this.lblProgress.Location = new System.Drawing.Point(50, 2); this.lblProgress.Name = "lblProgress"; this.lblProgress.Size = new System.Drawing.Size(158, 13); this.lblProgress.TabIndex = 2; this.lblProgress.Text = "Applying Operations to All Slices"; // // progressBar1 // this.progressBar1.ForeColor = System.Drawing.Color.DarkOrange; this.progressBar1.Location = new System.Drawing.Point(3, 16); this.progressBar1.Name = "progressBar1"; this.progressBar1.Size = new System.Drawing.Size(237, 23); this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Continuous; this.progressBar1.TabIndex = 3; this.progressBar1.Value = 50; // // picBoxZoom // this.picBoxZoom.IsPressed = false; this.picBoxZoom.Location = new System.Drawing.Point(72, 136); this.picBoxZoom.Margin = new System.Windows.Forms.Padding(0); this.picBoxZoom.Name = "picBoxZoom"; this.picBoxZoom.Size = new System.Drawing.Size(100, 100); this.picBoxZoom.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.picBoxZoom.TabIndex = 1; this.picBoxZoom.TabStop = false; this.picBoxZoom.Visible = false; // // picBoxMain // this.picBoxMain.Image = null; this.picBoxMain.Location = new System.Drawing.Point(0, 0); this.picBoxMain.Name = "picBoxMain"; this.picBoxMain.Size = new System.Drawing.Size(150, 140); this.picBoxMain.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.picBoxMain.TabIndex = 3; this.picBoxMain.TabStop = false; this.picBoxMain.MouseLeave += new System.EventHandler(this.txtBoxMain_MouseLeave); this.picBoxMain.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picBoxMain_MouseDown); this.picBoxMain.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picBoxMain_MouseMove); this.picBoxMain.Paint += new System.Windows.Forms.PaintEventHandler(this.picBoxMain_Paint); this.picBoxMain.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picBoxMain_MouseUp); this.picBoxMain.MouseEnter += new System.EventHandler(this.txtBoxMain_MouseEnter); // // picBoxAdjustments // this.picBoxAdjustments.BackColor = System.Drawing.Color.Transparent; this.picBoxAdjustments.Image = null; this.picBoxAdjustments.Location = new System.Drawing.Point(0, 0); this.picBoxAdjustments.Name = "picBoxAdjustments"; this.picBoxAdjustments.Size = new System.Drawing.Size(150, 140); this.picBoxAdjustments.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.picBoxAdjustments.TabIndex = 12; this.picBoxAdjustments.TabStop = false; this.picBoxAdjustments.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picBoxAdjustments_MouseDown); this.picBoxAdjustments.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picBoxAdjustments_MouseMove); this.picBoxAdjustments.Paint += new System.Windows.Forms.PaintEventHandler(this.picBoxAdjustments_Paint); this.picBoxAdjustments.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picBoxAdjustments_MouseUp); // // btnDone // this.btnDone.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnDone.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; this.btnDone.ImageIndex = 8; this.btnDone.IsFlat = false; this.btnDone.IsPressed = false; this.btnDone.Location = new System.Drawing.Point(338, 305); this.btnDone.Margin = new System.Windows.Forms.Padding(1); this.btnDone.Name = "btnDone"; this.btnDone.NgMediImage = null; this.btnDone.Padding = new System.Windows.Forms.Padding(2); this.btnDone.Size = new System.Drawing.Size(78, 22); this.btnDone.TabIndex = 45; this.btnDone.Text = "OK"; this.btnDone.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.btnDone.Visible = false; this.btnDone.Click += new System.EventHandler(this.btnDone_Click); // // textBoxMainPanel // this.textBoxMainPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(233)))), ((int)(((byte)(240))))); this.textBoxMainPanel.Controls.Add(this.txtBoxMain); this.textBoxMainPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.textBoxMainPanel.Location = new System.Drawing.Point(0, 0); this.textBoxMainPanel.Name = "textBoxMainPanel"; this.textBoxMainPanel.Padding = new System.Windows.Forms.Padding(5); this.textBoxMainPanel.Size = new System.Drawing.Size(416, 328); this.textBoxMainPanel.TabIndex = 7; this.textBoxMainPanel.Visible = false; // // txtBoxMain // this.txtBoxMain.BackColor = System.Drawing.SystemColors.Window; this.txtBoxMain.Dock = System.Windows.Forms.DockStyle.Fill; this.txtBoxMain.Location = new System.Drawing.Point(5, 5); this.txtBoxMain.Name = "txtBoxMain"; this.txtBoxMain.ReadOnly = true; this.txtBoxMain.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; this.txtBoxMain.Size = new System.Drawing.Size(406, 318); this.txtBoxMain.TabIndex = 4; this.txtBoxMain.Text = ""; this.txtBoxMain.MouseEnter += new System.EventHandler(this.txtBoxMain_MouseEnter); this.txtBoxMain.MouseLeave += new System.EventHandler(this.txtBoxMain_MouseLeave); this.txtBoxMain.MouseDown += new System.Windows.Forms.MouseEventHandler(this.txtBoxMain_MouseDown); // // Viewer // this.BackColor = System.Drawing.SystemColors.Control; this.Controls.Add(this.picBoxZoom); this.Controls.Add(this.OuterPanel); this.Name = "Viewer"; this.Size = new System.Drawing.Size(416, 328); this.Load += new System.EventHandler(this.Viewer_Load); this.Resize += new System.EventHandler(this.Viewer_Resize); this.OuterPanel.ResumeLayout(false); this.ribbonProgress.ResumeLayout(false); this.ribbonProgress.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.picBoxZoom)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picBoxMain)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picBoxAdjustments)).EndInit(); this.textBoxMainPanel.ResumeLayout(false); this.ResumeLayout(false); }
void _splitButtonGallery_ItemsSourceReady(object sender, EventArgs e) { // set label _splitButtonGallery.Label = "Brushes"; // prepare helper classes for commands _buttons = new RibbonButton[imageListBrushes.Images.Count]; uint i; for (i = 0; i < _buttons.Length; ++i) { _buttons[i] = new RibbonButton(_ribbon, 2000 + i) { Label = "Label " + i.ToString(), LargeImage = _ribbon.ConvertToUIImage((Bitmap)imageListBrushes.Images[(int)i]) }; } // set _splitButtonGallery items IUICollection itemsSource = _splitButtonGallery.ItemsSource; itemsSource.Clear(); i = 0; foreach (Image image in imageListBrushes.Images) { itemsSource.Add(new GalleryCommandPropertySet() { CommandID = 2000 + i++, CommandType = CommandType.Action, CategoryID = 1 }); } }
/// <summary> /// Gets the corners to round on the specified button /// </summary> /// <param name="r"></param> /// <param name="button"></param> /// <returns></returns> private Corners ButtonCorners(RibbonButton button) { if (!(button.OwnerItem is RibbonItemGroup)) { return Corners.All; } else { RibbonItemGroup g = button.OwnerItem as RibbonItemGroup; Corners c = Corners.None; if (button == g.FirstItem) { c |= Corners.West; } if (button == g.LastItem) { c |= Corners.East; } return c; } }
private void Initsymbol_list() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestForm)); Image[] images = new Image[13]; // RibbonProfessionalRenderer rend = new RibbonProfessionalRenderer(); // BackColor = rend.ColorTable.RibbonBackground; Random r = new Random(); for (int i = 0; i < images.Length; i++) { Bitmap b = new Bitmap((System.Drawing.Image)(resources.GetObject("ribbonButton_s" + (i + 1) + ".SmallImage"))); Bitmap c = new Bitmap((System.Drawing.Image)(resources.GetObject("ribbonButton_s" + (i + 1) + ".Image"))); images[i] = c; RibbonButton btn = new RibbonButton(); // btn.SmallImage = b; btn.Image = b; btn.Name = "symbols" + (i + 1); symbol_lst.Buttons.Add(btn); } RibbonButtonList lst2 = new RibbonButtonList(); for (int i = 0; i < images.Length; i++) { RibbonButton btn = new RibbonButton(); btn.Image = images[i]; btn.Name = "symbols" + (i + 1); btn.Click += new System.EventHandler(OnToolSelect); lst2.Buttons.Add(btn); } symbol_lst.DropDownItems.Add(lst2); /* RibbonButton[] buttons = new RibbonButton[30]; int square = 16; int squares = 4; int sqspace = 2; for (int i = 0; i < buttons.Length; i++) { #region Create color squares Bitmap colors = new Bitmap((System.Drawing.Image)(resources.GetObject("ribbonButton_s"+(i+1)+".Image"))); buttons[i] = new RibbonButton(colors);; buttons[i].MaxSizeMode = RibbonElementSizeMode.Medium; buttons[i].MinSizeMode = RibbonElementSizeMode.Medium; } RibbonButtonList blst = new RibbonButtonList(buttons); blst.FlowToBottom = false; blst.ItemsSizeInDropwDownMode = new Size(1, 10); itemColors.DropDownItems.Insert(0, blst); itemColors.DropDownResizable = true; #endregion*/ }
/// <summary> /// Determines button's dropDown corners /// </summary> /// <param name="button"></param> /// <returns></returns> private Corners ButtonDdRounding(RibbonButton button) { if (!(button.OwnerItem is RibbonItemGroup)) { if (button.SizeMode == RibbonElementSizeMode.Large) { return Corners.South; } else { return Corners.East; } } else { Corners c = Corners.None; RibbonItemGroup g = button.OwnerItem as RibbonItemGroup; if (button == g.LastItem) { c |= Corners.East; } return c; } }
/// <summary> /// Draws the arrow of buttons /// </summary> /// <param name="g"></param> /// <param name="button"></param> public void DrawButtonDropDownArrow(Graphics g, RibbonButton button, Rectangle textLayout) { Rectangle bounds = Rectangle.Empty; if (button.SizeMode == RibbonElementSizeMode.Large || button.SizeMode == RibbonElementSizeMode.Overflow) { bounds = LargeButtonDropDownArrowBounds(g, button.Owner.Font, button.Text, textLayout); } else { //bounds = new Rectangle( // button.ButtonFaceBounds.Right + (button.DropDownBounds.Width - arrowSize.Width) / 2, // button.Bounds.Top + (button.Bounds.Height - arrowSize.Height) / 2, // arrowSize.Width, arrowSize.Height); bounds = textLayout; } DrawArrowShaded(g, bounds, button.DropDownArrowDirection, button.Enabled); }
public void RibbonSplitButton() { RibbonControl ribbonControl = ComponentManager.Ribbon; ///////////////////////////////////// // create Ribbon tab RibbonTab Tab = new RibbonTab() { Title = "Drawing manager", Id = "DRAWINGMANAGER_TAB_ID" }; ribbonControl.Tabs.Add(Tab); #region Panels ///////////////////////////////////// // create Ribbon panel RibbonPanelSource xRefPanel = new RibbonPanelSource() { Title = "Xrefs" }; RibbonPanel xRefPane = new RibbonPanel() { Source = xRefPanel }; Tab.Panels.Add(xRefPane); RibbonPanelSource LayerUpdatePanel = new RibbonPanelSource() { Title = "Layer Update" }; RibbonPanel LayerUpdatePane = new RibbonPanel() { Source = LayerUpdatePanel }; Tab.Panels.Add(LayerUpdatePane); RibbonPanelSource DrawingMaintenancePanel = new RibbonPanelSource() { Title = "Drawing maintenance" }; RibbonPanel DrawingMaintenancePane = new RibbonPanel() { Source = DrawingMaintenancePanel }; Tab.Panels.Add(DrawingMaintenancePane); RibbonPanelSource ViewPanel = new RibbonPanelSource() { Title = "View" }; RibbonPanel ViewPane = new RibbonPanel() { Source = ViewPanel }; Tab.Panels.Add(ViewPane); RibbonPanelSource FunctionsPanel = new RibbonPanelSource() { Title = "Functions" }; RibbonPanel FunctionsPane = new RibbonPanel() { Source = FunctionsPanel }; Tab.Panels.Add(FunctionsPane); ////////////////////////////////////////////////// // create the buttons listed in the split button #endregion #region xRef Buttons RibbonButton xrefButton1 = new RibbonButton() { Text = "Add", ShowText = true, CommandHandler = new MyCmdHandler() }; RibbonButton xrefButton2 = new RibbonButton() { Text = "Unload", ShowText = true, CommandHandler = new MyCmdHandler() }; RibbonButton xrefButton3 = new RibbonButton() { Text = "Detach", ShowText = true, CommandHandler = new MyCmdHandler() }; #endregion #region Update Layers Buttons RibbonButton UpdateLayersThisDrawingButton = new RibbonButton() { Text = "This drawing", ShowText = true, CommandHandler = new MyCmdHandler() }; RibbonButton UpdateLayersMultipleDrawingsButton = new RibbonButton() { Text = "Multiple drawings", ShowText = true, CommandHandler = new MyCmdHandler() }; RibbonButton addLayerFromThisDrawingButton = new RibbonButton() { Text = "Select layer this drawing", ShowText = true, CommandHandler = new MyCmdHandler() }; RibbonButton addLayerFromXrefButton = new RibbonButton() { Text = "Select layer xref", ShowText = true, CommandHandler = new MyCmdHandler() }; RibbonButton editLayerConfigButton = new RibbonButton() { Text = "Edit layer config", ShowText = true, CommandHandler = new MyCmdHandler() }; #endregion #region Drawing management buttons RibbonButton PurgeButton = new RibbonButton() { Text = "Purge multiple drawings", ShowText = true, CommandHandler = new MyCmdHandler() }; RibbonButton ChangeAttributeValueButton = new RibbonButton() { Text = "Change attribute value", ShowText = true, CommandHandler = new MyCmdHandler() }; RibbonButton GenerateAttributeListButton = new RibbonButton() { Text = "Generate Attribute List", ShowText = true, CommandHandler = new MyCmdHandler() }; #endregion #region View Buttons RibbonButton TopDownButton = new RibbonButton() { Text = "Top Down", ShowText = true, CommandHandler = new MyCmdHandler() }; RibbonButton AdjustCableTraysButton = new RibbonButton() { Text = "Adjust Cable Trays", ShowText = true, CommandHandler = new MyCmdHandler() }; #endregion //////////////////////// // create split buttons RibbonSplitButton XrefSplitButton = new RibbonSplitButton() { // Required to avoid upsetting AutoCAD when using cmd locator Text = "Xref functions", ShowText = true }; RibbonSplitButton LayerUpdateSplitButton = new RibbonSplitButton() { Text = "Layer Update", ShowText = true }; RibbonLabel LayerUpdateLabel = new RibbonLabel() { Text = "Update layers in:" }; RibbonRowPanel DrawingMaintenanceRowPanel = new RibbonRowPanel(); RibbonRowPanel LayerUpdateRowPanel = new RibbonRowPanel(); DrawingMaintenanceRowPanel.Items.Add(PurgeButton); DrawingMaintenanceRowPanel.Items.Add(new RibbonRowBreak()); DrawingMaintenanceRowPanel.Items.Add(ChangeAttributeValueButton); DrawingMaintenanceRowPanel.Items.Add(new RibbonRowBreak()); DrawingMaintenanceRowPanel.Items.Add(GenerateAttributeListButton); XrefSplitButton.Items.Add(xrefButton1); XrefSplitButton.Items.Add(xrefButton2); XrefSplitButton.Items.Add(xrefButton3); LayerUpdateSplitButton.Items.Add(UpdateLayersThisDrawingButton); LayerUpdateSplitButton.Items.Add(UpdateLayersMultipleDrawingsButton); LayerUpdateRowPanel.Items.Add(LayerUpdateLabel); LayerUpdateRowPanel.Items.Add(LayerUpdateSplitButton); LayerUpdateRowPanel.Items.Add(new RibbonRowBreak()); LayerUpdateRowPanel.Items.Add(addLayerFromThisDrawingButton); LayerUpdateRowPanel.Items.Add(new RibbonRowBreak()); LayerUpdateRowPanel.Items.Add(addLayerFromXrefButton); LayerUpdateRowPanel.Items.Add(new RibbonRowBreak()); LayerUpdateRowPanel.Items.Add(editLayerConfigButton); ViewPanel.Items.Add(TopDownButton); FunctionsPanel.Items.Add(AdjustCableTraysButton); xRefPanel.Items.Add(XrefSplitButton); LayerUpdatePanel.Items.Add(LayerUpdateRowPanel); DrawingMaintenancePanel.Items.Add(DrawingMaintenanceRowPanel); Tab.IsActive = true; }