Example #1
0
 protected void AddMenu(ref Office.CommandBarButton btn, Office.CommandBar bar,
                        string strCaption, string strTooltip,
                        Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler handler)
 {
     btn = (Office.CommandBarButton)bar.Controls.Add(Office.MsoControlType.msoControlButton, missing, missing, missing, true);
     AddMenu(btn, strCaption, strTooltip, handler);
 }
Example #2
0
        AddButton(
            Office.CommandBarButton cbb,
            Office.CommandBar cbar,
            string name,
            Assembly asmbly,
            string bitMapName,
            string caption,
            string description,
            string toolTipText,
            Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler eventHandler)
        {
            object missing = System.Reflection.Missing.Value;

            try
            {
                cbb = (Office.CommandBarButton)cbar.Controls.Add(Office.MsoControlType.msoControlButton, missing, missing, missing, missing);

                cbb.Style           = Office.MsoButtonStyle.msoButtonIconAndCaption;
                cbb.Caption         = caption;
                cbb.DescriptionText = description;
                cbb.Picture         = ConvertImage.GetPicture(asmbly, bitMapName);
                cbb.TooltipText     = toolTipText;
                cbb.Tag             = Common.TAG_PREFIX + name;
                cbb.Click          += eventHandler;
                return(cbb);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                // TODO: Add Logging
                throw ex;
            }
        }
Example #3
0
        protected void AddMenu(Office.CommandBarButton btn, string strCaption, string strTooltip,
                               Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler handler)
        {
            btn.Style       = Microsoft.Office.Core.MsoButtonStyle.msoButtonCaption;
            btn.Caption     = strCaption;
            btn.Tag         = strCaption;
            btn.TooltipText = strTooltip;
            btn.Click      += handler;

            // this setting, along with a registry key of DemandLoad = 8 (or 9), causes us not to be
            //  loaded until the user actually requests us.
#if DEBUG   // when debugging, we go directly with the .Net assembly (rather than the shim)
            btn.OnAction = "!<SILConvertersOffice.Connect>";
#else
            btn.OnAction = "!<SILConvertersOfficeShim.Connect>";
#endif
        }
Example #4
0
        AddButton(
            Office.CommandBarButton cbb,
            Office.CommandBar cbar,
            string name,
            string caption,
            string description,
            string toolTipText,
            Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler eventHandler)
        {
            cbb = (Office.CommandBarButton)cbar.Controls.Add(Office.MsoControlType.msoControlButton, Missing.Value, Missing.Value, Missing.Value, Missing.Value);

            cbb.Style           = Office.MsoButtonStyle.msoButtonCaption;
            cbb.Caption         = caption;
            cbb.DescriptionText = description;
            cbb.TooltipText     = toolTipText;
            cbb.Tag             = Common.TAG_PREFIX + name;
            cbb.Click          += new Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler(eventHandler);
            return(cbb);
        }
Example #5
0
 private void AddMenuCommand(Office.CommandBarPopup cmdBarControl, ref Office.CommandBarButton menuCommand, string cmdID, string cmdCAPTION, Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler clickHandler, int faceID)
 {
     menuCommand = (Office.CommandBarButton)cmdBarControl.Controls.Add(
         Office.MsoControlType.msoControlButton, missing, missing, missing, missing);
     //menuCommand = cmdBarControl.Controls.Add(
     //    Office.MsoControlType.msoControlButton, missing, missing, missing, missing);
     menuCommand.Caption = cmdCAPTION;
     menuCommand.Tag     = cmdID;
     menuCommand.FaceId  = faceID;
     menuCommand.Click  += clickHandler;
 }