Example #1
0
        public IWordButton CreateButton(IWordCommandBar parent, string commandId, ToolStripItemDisplayStyle style, string caption, string toolTip,
             Image image, bool beginGroup)
        {
            CommandBarButtonWrapper wrapper = new CommandBarButtonWrapper(
                parent, style, caption, toolTip, commandId, image, beginGroup);

            return wrapper;
        }
 public CommandBarButtonWrapper(IWordCommandBar parent, ToolStripItemDisplayStyle style, string caption, string toolTip,
     string commandId, Image image, bool beginGroup)
 {
     _parent = parent;
     _imageDisplayStyle = style;
     _caption = caption;
     _commandId = commandId;
     _glyph = image;
     _beginsGroup = beginGroup;
     _toolTip = toolTip;
 }
Example #3
0
        public void AddBar(IWordCommandBar bar)
        {
            CommandBar commandBar = null;
            //todo: сделать так, чтобы второй раз создать нельзя было
            try
            {
                commandBar = Globals.ThisAddIn.Application.CommandBars[bar.Id];
            }
            catch ( ArgumentException ) { }

            if ( commandBar == null )
                commandBar = Globals.ThisAddIn.Application.CommandBars.Add(bar.Id, ( object )MsoBarPosition.msoBarTop, _null, true);

            commandBar.Visible = true;
        }