示例#1
0
        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;
            }
        }
示例#2
0
        public bool GetButtonState(MetroToolbarButtonType btnType)
        {
            foreach (IMetroToolBarButton btn in Controls)
            {
                if (btn.ButtonType == btnType)
                {
                    if (!(btn is MetroToolbarSeparator))
                    {
                        return(btn.Visible);
                    }
                }
            }

            return(false);
        }
示例#3
0
        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));
        }
示例#4
0
        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;
            }
        }
示例#5
0
        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;
            }
        }
示例#6
0
        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;
            }
        }
示例#7
0
        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;
            }
        }
示例#8
0
 protected virtual void OnItemClicked(MetroToolbarButtonType buttonType)
 {
 }