예제 #1
0
        private XlCommandBarControl ReturnHelper(MsoControlType type, object comRef)
        {
            switch (type)
            {
            case MsoControlType.msoControlButton:

                XlCommandBarButton newButton = new XlCommandBarButton(this, comRef);
                ListChildReferences.Add(newButton);
                return(newButton);

            case MsoControlType.msoControlPopup:

                XlCommandBarPopup newPopup = new XlCommandBarPopup(this, comRef);
                ListChildReferences.Add(newPopup);
                return(newPopup);

            case MsoControlType.msoControlComboBox:

                XlCommandBarComboBox newBox = new XlCommandBarComboBox(this, comRef);
                ListChildReferences.Add(newBox);
                return(newBox);

            default:

                XlCommandBarControl newClass = new XlCommandBarControl(this, comRef);
                ListChildReferences.Add(newClass);
                return(newClass);
            }
        }
 public void SetupEventBinding(XlCommandBarComboBox comboBox)
 {
     if (true == XlLateBindingApiSettings.EventsEnabled)
     {
         _comboBox = comboBox;
         IConnectionPointContainer connectionPointContainer = (IConnectionPointContainer)comboBox.COMReference;
         Guid guid = new Guid("{000C0354-0000-0000-C000-000000000046}");
         connectionPointContainer.FindConnectionPoint(ref guid, out _connectionPoint);
         _connectionPoint.Advise(this, out _connectionCookie);
     }
 }
예제 #3
0
        internal void RaiseChangeEvent(object Ctrl)
        {
            if (null == Change)
            {
                Marshal.ReleaseComObject(Ctrl);
                return;
            }

            XlCommandBarComboBox box = new XlCommandBarComboBox(this, Ctrl);

            ListChildReferences.Add(box);

            Change(box);
        }