示例#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);
            }
        }
示例#2
0
 /// <summary>
 /// returns an XlCommandBarControl by Index, not 0 based
 /// </summary>
 /// <param name="i"></param>
 /// <returns></returns>
 public XlCommandBarControl this[int index]
 {
     get
     {
         object[] paramArray = new object[1];
         paramArray[0] = index;
         object comRef = InstanceType.InvokeMember("Item", BindingFlags.GetProperty, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);
         XlCommandBarControl newClass = new XlCommandBarControl(this, comRef);
         ListChildReferences.Add(newClass);
         return(newClass);
     }
 }
示例#3
0
        public XlCommandBarControl Move(object bar, object before)
        {
            object[] paramArray = new object[2];
            paramArray[0] = bar;
            paramArray[1] = before;
            object returnValue = InstanceType.InvokeMember("Move", BindingFlags.InvokeMethod, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);

            if (null == returnValue)
            {
                return(null);
            }
            XlCommandBarControl newClass = new XlCommandBarControl(this, returnValue);

            ListChildReferences.Add(newClass);
            return(newClass);
        }
示例#4
0
        /// <summary>
        /// Foreach Enumerator
        /// </summary>
        /// <returns></returns>
        public IEnumerator GetEnumerator()
        {
            int iCount = Count;

            XlCommandBarControl[] res_addins = new XlCommandBarControl[iCount];

            for (int i = 1; i <= iCount; i++)
            {
                res_addins[i - 1] = this[i];
            }

            for (int i = 0; i < res_addins.Length; i++)
            {
                yield return(res_addins[i]);
            }
        }
示例#5
0
        public XlCommandBarControl FindControl(object type, object id, object tag, object visible)
        {
            object[] paramArray = new object[4];
            paramArray[0] = type;
            paramArray[1] = id;
            paramArray[2] = tag;
            paramArray[3] = visible;
            object returnValue = InstanceType.InvokeMember("FindControl", BindingFlags.InvokeMethod, null, ComReference, paramArray, XlLateBindingApiSettings.XlThreadCulture);

            if (null == returnValue)
            {
                return(null);
            }
            XlCommandBarControl newClass = new XlCommandBarControl(this, returnValue);

            ListChildReferences.Add(newClass);
            return(newClass);
        }