示例#1
0
 /// <summary>
 /// Check if there is enough space to expand the capacity
 /// </summary>
 /// <param name="elements">Number of elements to be added</param>
 private void EnsureSpace(int elements)
 {
     if (elements + this._Count > m_controls.Length)
     {
         STNodeControl[] arrTemp = new STNodeControl[Math.Max(m_controls.Length * 2, elements + this._Count)];
         m_controls.CopyTo(arrTemp, 0);
         m_controls = arrTemp;
     }
 }
示例#2
0
        public void Remove(STNodeControl control)
        {
            int nIndex = this.IndexOf(control);

            if (nIndex != -1)
            {
                this.RemoveAt(nIndex);
            }
        }
示例#3
0
        public int Add(STNodeControl control)
        {
            if (control == null)
            {
                throw new ArgumentNullException("Add object cannot be null");
            }
            this.EnsureSpace(1);
            int nIndex = this.IndexOf(control);

            if (-1 == nIndex)
            {
                nIndex                    = this._Count;
                control.Owner             = m_owner;
                m_controls[this._Count++] = control;
                this.Redraw();
            }
            return(nIndex);
        }
示例#4
0
 public void Insert(int index, STNodeControl control)
 {
     if (index < 0 || index >= this._Count)
     {
         throw new IndexOutOfRangeException("Index out of bounds");
     }
     if (control == null)
     {
         throw new ArgumentNullException("Insert object cannot be null");
     }
     this.EnsureSpace(1);
     for (int i = this._Count; i > index; i--)
     {
         m_controls[i] = m_controls[i - 1];
     }
     control.Owner     = m_owner;
     m_controls[index] = control;
     this._Count++;
     this.Redraw();
 }
示例#5
0
 public int IndexOf(STNodeControl option)
 {
     return(Array.IndexOf <STNodeControl>(m_controls, option));
 }
示例#6
0
 public bool Contains(STNodeControl option)
 {
     return(this.IndexOf(option) != -1);
 }