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); } }
/// <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); } }
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); }
/// <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]); } }
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); }