private void SetupGui() { /* create commandbar */ Office.CommandBar commandBar = _outlookApplication.ActiveExplorer().CommandBars.Add("工具栏名称", MsoBarPosition.msoBarTop, System.Type.Missing, true); commandBar.Visible = true; // add popup to commandbar //Office.CommandBarPopup commandBarPop = (Office.CommandBarPopup)commandBar.Controls.Add(MsoControlType.msoControlPopup, System.Type.Missing, System.Type.Missing, System.Type.Missing, true); //commandBarPop.Caption = CultureRes.ProductTitle; //commandBarPop.Tag = CultureRes.ProductTitle; // add a button to the popup LogonBtn = (Office.CommandBarButton)commandBar.Controls.Add(MsoControlType.msoControlButton, Type.Missing, Type.Missing, Type.Missing, true); LogonBtn.Style = MsoButtonStyle.msoButtonIconAndCaption; LogonBtn.Picture = PictureConverter.IconToPicture(Properties.Resources.SampleIcon2); LogonBtn.Mask = PictureConverter.ImageToPicture(Properties.Resources.sampleicon2Mask); LogonBtn.Caption = "按钮"; //LogonBtn.ClickEvent += new NetOffice.OfficeApi.CommandBarButton_ClickEventHandler(LoginBtn_ClickEvent); }
public stdole.IPictureDisp GetButtonImage(NetOffice.OfficeApi.IRibbonControl control) { return(PictureConverter.IconToPictureDisp(Properties.Resources.SampleIcon2)); }