//添加单独的菜单项 public void AddMenu(Microsoft.Office.Core.CommandBarPopup popuBar) { Microsoft.Office.Core.CommandBar menuBar = null; menuBar = this.OWordApplic.CommandBars["Menu Bar"]; popuBar = (Microsoft.Office.Core.CommandBarPopup) this.OWordApplic.CommandBars.FindControl(Microsoft.Office.Core.MsoControlType.msoControlPopup, missing, popuBar.Tag, true); if (popuBar == null) { popuBar = (Microsoft.Office.Core.CommandBarPopup)menuBar.Controls.Add(Microsoft.Office.Core.MsoControlType.msoControlPopup, missing, missing, missing, missing); } }
public static Microsoft.Office.Core.CommandBarPopup AddNewPopup(this Microsoft.Office.Core.CommandBarPopup cmdbarpopup, string tag, string caption) { var new_popup = (Microsoft.Office.Core.CommandBarPopup)cmdbarpopup.Controls.Add( Microsoft.Office.Core.MsoControlType.msoControlPopup, // Type missing, // Object missing, // Id cmdbarpopup.Controls.Count + 1, // Before true // Temporary ); new_popup.Caption = caption; new_popup.Tag = tag; return(new_popup); }
public static Microsoft.Office.Core.CommandBarButton AddNewMenuItem(this Microsoft.Office.Core.CommandBarPopup cmdbarpopup, string tag, string caption, Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler handler) { var before_pos = cmdbarpopup.Controls.Count + 1; var btn = (Microsoft.Office.Core.CommandBarButton)cmdbarpopup.Controls.Add( Microsoft.Office.Core.MsoControlType.msoControlButton, // Type missing, // Object missing, // Id before_pos, // Before true // Temporary ); btn.Style = Microsoft.Office.Core.MsoButtonStyle.msoButtonIconAndCaption; btn.Caption = caption; btn.Tag = tag; btn.Click += handler; return(btn); }
public CommandBarPopup(Microsoft.Office.Core.CommandBarPopup target) : base(target) { }
public CommandBarPopup(Microsoft.Office.Core.CommandBarPopup target, bool rewrapping = false) : base(target, rewrapping) { }