Пример #1
0
        private void DefineCommandButton(IToolBarComponent comp, IToolBarCommandButton element)
        {
            ToolStripButton button = new ToolStripButton();

            button.Image  = element.Icon;
            button.Tag    = new ButtonTag(GetCommandTarget(), comp, element.Command);
            button.Size   = new Size(24, 23);
            button.Click += delegate(object sender, EventArgs args) {
                DoCommand(element.Command);
            };
            IGeneralCommand gc = (IGeneralCommand)element.Command.GetAdapter(typeof(IGeneralCommand));

            if (gc != null)
            {
                if (!String.IsNullOrEmpty(gc.Description))
                {
                    button.ToolTipText = gc.Description;
                }
            }
            else if (!String.IsNullOrEmpty(element.ToolTipText))
            {
                button.ToolTipText = element.ToolTipText;
            }

            _currentToolStrip.Items.Add(button);
        }
Пример #2
0
        private void DefineCommandButton(IToolBarComponent comp, IToolBarCommandButton element)
        {
            ToolStripButton button = new ToolStripButton();
            button.Image = element.Icon;
            button.Tag = new ButtonTag(GetCommandTarget(), comp, element.Command);
            button.Size = new Size(24, 23);
            button.Click += delegate(object sender, EventArgs args) {
                DoCommand(element.Command);
            };
            IGeneralCommand gc = (IGeneralCommand)element.Command.GetAdapter(typeof(IGeneralCommand));
            if (gc != null) {
                if (!String.IsNullOrEmpty(gc.Description))
                    button.ToolTipText = gc.Description;
            }
            else if (!String.IsNullOrEmpty(element.ToolTipText)) {
                button.ToolTipText = element.ToolTipText;
            }

            _currentToolStrip.Items.Add(button);
        }