/// <summary> /// 移除所有的子元素 /// </summary> public override void RemoveAllChildren() { RibbonElement element2; for (RibbonElement element = this.FirstChild; element != null; element = element2) { element2 = element.NextSibling(); this.RemoveChild <RibbonElement>(element); } }
/// <summary> /// 获取枚举器 /// </summary> /// <returns></returns> public override IEnumerator <RibbonElement> GetEnumerator() { if (!this._container.HasChildren || (this._container.FirstChild == null)) { goto labl_ret; } RibbonElement firstChild = this._container.FirstChild; while (firstChild != null) { yield return(firstChild); firstChild = firstChild.NextSibling(); } labl_ret :; }
/// <summary> /// 根据下标获取元素 /// </summary> /// <param name="index"></param> /// <returns></returns> public override RibbonElement GetItem(int index) { if (this._container.HasChildren) { for (RibbonElement element = this._container.FirstChild; element != null; element = element.NextSibling()) { if (index == 0) { return(element); } index--; } } throw new ArgumentOutOfRangeException("index"); }