private object AddContextMenu(string caption, string tag) { //application.CustomizationContext = application.ActiveDocument; Office.CommandBar commandBar = application.CommandBars["Text"]; // Remove if there is a duplicate already. Office.CommandBarButton control = (Office.CommandBarButton)commandBar.FindControl (Office.MsoControlType.msoControlButton, missing, tag, true, true); if ((control != null)) { contextButtons.Remove(tag); control.Delete(true); } //Create the new menu buttion and add it. Office.CommandBarButton button = (Office.CommandBarButton)commandBar.Controls.Add( Office.MsoControlType.msoControlButton); button.accName = caption; button.Caption = caption; button.Tag = tag; button.Click += ConextMenu_Click; contextButtons.Add(tag, button); return(button); }
private void ThisAddIn_Shutdown(object sender, EventArgs e) { _drawGraphButton.Delete(); _drawAllGraphsButton1.Delete(); _drawAllGraphsButton2.Delete(); }
private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { addBtn.Delete(true); //RemoveRightBtns(); }