コード例 #1
0
        /// <summary>
        /// Inserts blanks entries before the current location.
        /// The current location becomes the first inserted item.
        /// </summary>
        /// <param name="quantity">Number of entries to insert.</param>
        public virtual void Insert(int quantity = 1)
        {
            // Shifts current indices
            if (_fonts.MoveLast())
            {
                do
                {
                    if (_fonts.CurrentKey >= _index)
                    {
                        Font currentFont = _fonts.CurrentValue;
                        int  newKey      = _fonts.CurrentKey + quantity;
                        _fonts.Remove();
                        _fonts.Add(newKey, currentFont);
                    }
                } while (_fonts.MovePrevious());
            }

            // Adds blank spaces
            for (int i = _index; i < _index + quantity; i++)
            {
                _fonts.Add(_index, null);
            }
        }