⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wndlesscontrolcollection.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Pc.WndlessControls
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Reflection;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    public class WndlessControlCollection : ICollection<WndlessControl>, IEnumerable<WndlessControl>, IEnumerable
    {
        private WndlessContainerEngine _engine;
        private volatile int _invalidateSuspendCount;
        private List<WndlessControl> _list;
        private Control _owner;
        private Rectangle _rcInvalidate = Rectangle.Empty;

        public WndlessControlCollection(Control owner)
        {
            this._owner = owner;
            this._list = new List<WndlessControl>();
            this._engine = new WndlessContainerEngine(this);
        }

        public void Add(WndlessControl item)
        {
            item.OwnedCollection = this;
            this._list.Add(item);
            this.Invalidate(item.Bounds);
        }

        public void Clear()
        {
            if (this._list.get_Count() > 0)
            {
                Rectangle a = this._list.get_Item(0).Bounds;
                for (int i = 1; i < this._list.get_Count(); i++)
                {
                    a = Rectangle.Union(a, this._list.get_Item(i).Bounds);
                }
                this._list.Clear();
                this.Invalidate(a);
            }
        }

        public bool Contains(WndlessControl item)
        {
            return this._list.Contains(item);
        }

        public IEnumerator<WndlessControl> GetEnumerator()
        {
            return this._list.GetEnumerator();
        }

        public void Invalidate(Rectangle rc)
        {
            if (Rectangle.Empty != this._rcInvalidate)
            {
                this._rcInvalidate = Rectangle.Union(this._rcInvalidate, rc);
            }
            else
            {
                this._rcInvalidate = rc;
            }
            this.TryInvalidate();
        }

        public bool Remove(WndlessControl item)
        {
            bool flag = this._list.Remove(item);
            if (flag)
            {
                this.Invalidate(item.Bounds);
            }
            return flag;
        }

        public void ResumeInvalidate()
        {
            this._invalidateSuspendCount--;
            this.TryInvalidate();
        }

        public void SuspendInvalidate()
        {
            this._invalidateSuspendCount++;
        }

        void ICollection<WndlessControl>.CopyTo(WndlessControl[] array, int arrayIndex)
        {
            this._list.CopyTo(array, arrayIndex);
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return this._list.GetEnumerator();
        }

        private void TryInvalidate()
        {
            if ((this._invalidateSuspendCount == 0) && (this.OwnerControl != null))
            {
                this.OwnerControl.Invalidate(this._rcInvalidate);
                this._rcInvalidate = Rectangle.Empty;
            }
        }

        public int Count
        {
            get
            {
                return this._list.get_Count();
            }
        }

        public WndlessControl this[int index]
        {
            get
            {
                return this._list.get_Item(index);
            }
        }

        public Control OwnerControl
        {
            get
            {
                return this._owner;
            }
        }

        bool ICollection<WndlessControl>.IsReadOnly
        {
            get
            {
                return this._list.get_IsReadOnly();
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -