private void metroToolbar_ItemClicked(object sender, MetroToolbarButtonType e) { switch (e) { case MetroToolbarButtonType.New: OnNewEvent(); break; case MetroToolbarButtonType.Edit: OnEditEvent(); break; case MetroToolbarButtonType.Save: OnSaveEvent(); break; case MetroToolbarButtonType.Delete: OnDeleteEvent(); break; case MetroToolbarButtonType.Search: OnSearchEvent(); break; case MetroToolbarButtonType.Filter: OnFindEvent(); break; case MetroToolbarButtonType.Undo: OnUndoEvent(); break; case MetroToolbarButtonType.Exit: OnExitEvent(); break; case MetroToolbarButtonType.Preference: OnPreferenceEvent(); break; case MetroToolbarButtonType.Print: throw new NotImplementedException("Print Error: Missing something"); case MetroToolbarButtonType.Preview: throw new NotImplementedException("Preview Error: Missing something"); case MetroToolbarButtonType.AddOn: aopAddons.ChangeStatus(AddonWidth); break; case MetroToolbarButtonType.Custom: OnCustomToolbarButtonClick(sender as IMetroToolBarButton); break; } }
public bool GetButtonState(MetroToolbarButtonType btnType) { foreach (IMetroToolBarButton btn in Controls) { if (btn.ButtonType == btnType) { if (!(btn is MetroToolbarSeparator)) { return(btn.Visible); } } } return(false); }
public T GetButton <T>(MetroToolbarButtonType btnType) { foreach (IMetroToolBarButton btn in Controls) { if (btn.ButtonType == btnType) { if (!(btn is MetroToolbarSeparator)) { return((T)Convert.ChangeType(btn, typeof(T))); } } } return(default(T)); }
public void AddSplitToolbarButton(MetroToolbarButtonType btnType, string text, string tag, Image image) { var btn = GetButton <MetroToolbarDropDownButton>(btnType); var mnuBtn = new ToolStripMenuItem(text) { Tag = tag, Image = image }; btn.AddDropDownItem(mnuBtn); if (btn.Items.Count == 1) { btn.DropDownItemClicked += Btn_DropDownItemClicked; } }
public void AddSplitToolbarButton(MetroToolbarButtonType btnType, string text, string tag, System.Drawing.Image image) { metroToolbar.AddSplitToolbarButton(btnType, text, tag, image); switch (btnType) { case MetroToolbarButtonType.Preference: metroToolbar.ButtonPrefVisible = true; break; case MetroToolbarButtonType.Preview: metroToolbar.ButtonPreviewVisible = true; break; case MetroToolbarButtonType.Print: metroToolbar.ButtonPrintVisible = true; break; } }
private void metroToolbar_ItemClicked(object sender, MetroToolbarButtonType e) { switch (e) { case MetroToolbarButtonType.Preview: OnPreviewEvent(); break; case MetroToolbarButtonType.Print: OnPrintEvent(); break; case MetroToolbarButtonType.Exit: OnExitEvent(); break; case MetroToolbarButtonType.Preference: OnPreferenceEvent(); break; } }
private void metroToolbar_ItemClicked(object sender, MetroToolbarButtonType e) { switch (e) { case MetroToolbarButtonType.New: OnNewEvent(); break; case MetroToolbarButtonType.Edit: OnEditEvent(); break; case MetroToolbarButtonType.Save: OnSaveEvent(); break; case MetroToolbarButtonType.Undo: OnUndoEvent(); break; case MetroToolbarButtonType.Exit: OnExitEvent(); break; case MetroToolbarButtonType.Preference: OnPreferenceEvent(); break; case MetroToolbarButtonType.Print: throw new NotImplementedException("Print Error: Missing something"); case MetroToolbarButtonType.Preview: throw new NotImplementedException("Preview Error: Missing something"); case MetroToolbarButtonType.Custom: OnCustomToolbarButtonClick(sender as IMetroToolBarButton); break; } }
protected virtual void OnItemClicked(MetroToolbarButtonType buttonType) { }