private BarItem CreateDropDown(IRibbonItem item) { ICommandSubType comboSetting = item as ICommandSubType; BarSubItem dropItem = new BarSubItem() { Name = item.Key, Caption = item.Caption }; if (item.Image != null) { if (item.Image.Width > 24 || item.Image.Height > 24) { dropItem.LargeGlyph = item.Image; } else { dropItem.Glyph = item.Image; } } //for (int i = 0; i < comboSetting.GetCount(); i++) //{ // ((ICommandSubType)item).SetSubType(i); // BarItem button = _ribbonManager.Items[item.Key]; // dropItem.LinksPersistInfo.Add(new LinkPersistInfo() { Item = button }); //} BarManagerCategory category = CheckCategoryExists(item.Category); dropItem.Category = category; _ribbonManager.Items.Add(dropItem); return(dropItem); }
private BarItem CreateCheckBox(IRibbonItem item) { BarCheckItem button = new BarCheckItem() { Name = item.Key, Caption = item.Caption }; if (item.Image != null) { if (item.Image.Width > 24 || item.Image.Height > 24) { button.LargeGlyph = item.Image; } else { button.Glyph = item.Image; } } button.Checked = item.Checked; button.Tag = item; button.ItemClick += ((YutaiCommand)item).OnClick; //开始检查Category是否存在 BarManagerCategory category = CheckCategoryExists(item.Category); button.Category = category; _ribbonManager.Items.Add(button); return(button); }
private void FireMessageSetting(object sender, ItemClickEventArgs e) { IRibbonItem command = e.Item.Tag as IRibbonItem; if (command == null) { return; } SetStatusValue("Status_Message", command.Message); }
private BarItem CreateComboBox(IRibbonItem item) { ICommandComboBox comboSetting = item as ICommandComboBox; //ComboBoxEdit comboBox = new ComboBoxEdit() //{ // Name = item.Key, // Caption = item.Caption //}; BarEditItem comboBox = new BarEditItem() { Name = item.Key, Caption = item.Caption, Width = 230 }; RepositoryItemComboBox cmbEdit = new RepositoryItemComboBox() { Name = item.Key + "_combo", BestFitWidth = 300 }; //cmbEdit.Buttons.AddRange(new EditorButton[] {new EditorButton(ButtonPredefines.Combo) }); comboBox.Edit = cmbEdit; if (comboSetting.DropDownList) { //cmbEdit.AllowDropDownWhenReadOnly = DefaultBoolean.True; //cmbEdit.ReadOnly = true; } object[] objectItems = comboSetting.Items; if (objectItems != null) { for (int i = 0; i < objectItems.Length; i++) { cmbEdit.Items.Add(objectItems[i]); } } comboBox.Tag = item; comboSetting.LinkComboBox = comboBox; comboBox.EditValueChanged += ((ICommandComboBox)item).OnEditValueChanged; comboSetting.LinkComboBox = comboBox; //开始检查Category是否存在 BarManagerCategory category = CheckCategoryExists(item.Category); comboBox.Category = category; _ribbonManager.Items.Add(comboBox); return(comboBox); }
private BarItem CreateButton(IRibbonItem item) { BarButtonItem button = new BarButtonItem() { Name = item.Key, Caption = item.Caption }; if (item.Image != null) { if (item.Image.Width > 24 || item.Image.Height > 24) { button.LargeGlyph = item.Image; } else { button.Glyph = item.Image; } } else { button.PaintStyle = BarItemPaintStyle.Caption; } button.Tag = item; button.Enabled = item.Enabled; button.Down = item.Checked; button.ItemClick += ((YutaiCommand)item).OnClick; if (item.ItemType == RibbonItemType.Tool) { button.ButtonStyle = BarButtonStyle.Check; button.ItemClick += SetCurrentTool; } else { button.ButtonStyle = BarButtonStyle.Default; } //开始检查Category是否存在 BarManagerCategory category = CheckCategoryExists(item.Category); button.Category = category; _ribbonManager.Items.Add(button); return(button); }
private BarItem CreateRibbonEditItem(IRibbonItem item) { IRibbonEditItem comboSetting = item as IRibbonEditItem; //ComboBoxEdit comboBox = new ComboBoxEdit() //{ // Name = item.Key, // Caption = item.Caption //}; BarEditItem comboBox = new BarEditItem() { Name = item.Key, Caption = item.Caption, Width = comboSetting.Width }; RepositoryItemComboBox cmbEdit = new RepositoryItemComboBox() { Name = item.Key + "_combo", BestFitWidth = 300 }; //cmbEdit.Buttons.AddRange(new EditorButton[] {new EditorButton(ButtonPredefines.Combo) }); comboBox.Edit = cmbEdit; comboBox.Tag = item; comboSetting.RibbonEditItem = cmbEdit; //comboSetting.LinkComboBox = comboBox; //comboBox.EditValueChanged += ((ICommandComboBox)item).OnEditValueChanged; //comboSetting.LinkComboBox = comboBox; //开始检查Category是否存在 BarManagerCategory category = CheckCategoryExists(item.Category); comboBox.Category = category; _ribbonManager.Items.Add(comboBox); return(comboBox); }
public RibbonMenuItem(string key, IRibbonItem item, object stripItem) { _key = key; _item = item; _object = stripItem; }
public RibbonMenuItem(string key, IRibbonItem item, ToolStripItem stripItem) { _key = key; _item = item; _stripItem = stripItem; }