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

📄 xtabcontrol.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 4 页
字号:
        }

        [Browsable(true), DefaultValue(1), Category("XControl"), Description("Tab的风格")]
        public Imps.Client.Pc.XControls.XTabStyle XTabStyle
        {
            get
            {
                return this._xTabStyle;
            }
            set
            {
                this._drawer = this.GetDrawer(value);
                this._xTabStyle = value;
            }
        }

        [ComVisible(false)]
        public class ControlCollection : Control.ControlCollection
        {
            private XTabControl owner;

            public ControlCollection(XTabControl owner) : base(owner)
            {
                this.owner = owner;
            }

            public override void Add(Control value)
            {
                if (!(value is XTabPage))
                {
                    throw new ArgumentException("value");
                }
                this.owner.Insert(this.owner.TabCount, (XTabPage) value);
                base.Add(value);
            }

            public override void Remove(Control value)
            {
                base.Remove(value);
                if (value is XTabPage)
                {
                    int index = this.owner.FindTabPage((XTabPage) value);
                    int selectedIndex = this.owner.SelectedIndex;
                    if (index != -1)
                    {
                        this.owner.RemoveTabPage(index);
                        if (index == selectedIndex)
                        {
                            this.owner.SelectedIndex = 0;
                        }
                    }
                    this.owner.Invalidate(false);
                }
            }
        }

        public class XTabPageCollection : IList, ICollection, IEnumerable
        {
            private int lastAccessedIndex;
            private XTabControl owner;

            public XTabPageCollection(XTabControl owner)
            {
                this.owner = owner;
            }

            public void Add(XTabPage value)
            {
                if (value == null)
                {
                    throw new ArgumentNullException("value");
                }
                this.owner.Controls.Add(value);
            }

            public int Add(object value)
            {
                if (!(value is XTabPage))
                {
                    throw new ArgumentException("value");
                }
                this.Add((XTabPage) value);
                return this.IndexOf((XTabPage) value);
            }

            public void Add(string text)
            {
                XTabPage page = new XTabPage();
                page.Text = text;
                this.Add(page);
            }

            public void Add(string key, string text)
            {
                XTabPage page = new XTabPage();
                page.Name = key;
                page.Text = text;
                this.Add(page);
            }

            public void Add(string key, string text, int imageIndex)
            {
                XTabPage page = new XTabPage();
                page.Name = key;
                page.Text = text;
                page.ImageIndex = imageIndex;
                this.Add(page);
            }

            public void Add(string key, string text, string imageKey)
            {
                XTabPage page = new XTabPage();
                page.Name = key;
                page.Text = text;
                page.ImageKey = imageKey;
                this.Add(page);
            }

            public void AddRange(XTabPage[] pages)
            {
                if (pages == null)
                {
                    throw new ArgumentNullException("pages");
                }
                foreach (XTabPage page in pages)
                {
                    this.Add(page);
                }
            }

            public virtual void Clear()
            {
                this.owner.RemoveAll();
            }

            public bool Contains(XTabPage page)
            {
                if (page == null)
                {
                    throw new ArgumentNullException("value");
                }
                return (this.IndexOf(page) != -1);
            }

            public bool Contains(object page)
            {
                if (page is XTabPage)
                {
                    return this.Contains((XTabPage) page);
                }
                return false;
            }

            public virtual bool ContainsKey(string key)
            {
                return this.IsValidIndex(this.IndexOfKey(key));
            }

            public void CopyTo(Array dest, int index)
            {
                if (this.Count > 0)
                {
                    Array.Copy(this.owner.GetTabPages(), 0, dest, index, this.Count);
                }
            }

            public IEnumerator GetEnumerator()
            {
                TabPage[] tabPages = this.owner.GetTabPages();
                if (tabPages != null)
                {
                    return tabPages.GetEnumerator();
                }
                return new TabPage[0].GetEnumerator();
            }

            public int IndexOf(XTabPage page)
            {
                if (page == null)
                {
                    throw new ArgumentNullException("value");
                }
                for (int i = 0; i < this.Count; i++)
                {
                    if (this[i] == page)
                    {
                        return i;
                    }
                }
                return -1;
            }

            public int IndexOf(object page)
            {
                if (page is XTabPage)
                {
                    return this.IndexOf((XTabPage) page);
                }
                return -1;
            }

            public virtual int IndexOfKey(string key)
            {
                if (!string.IsNullOrEmpty(key))
                {
                    if (this.IsValidIndex(this.lastAccessedIndex) && this.SafeCompareStrings(this[this.lastAccessedIndex].Name, key, true))
                    {
                        return this.lastAccessedIndex;
                    }
                    for (int i = 0; i < this.Count; i++)
                    {
                        if (this.SafeCompareStrings(this[i].Name, key, true))
                        {
                            this.lastAccessedIndex = i;
                            return i;
                        }
                    }
                    this.lastAccessedIndex = -1;
                }
                return -1;
            }

            public void Insert(int index, XTabPage tabPage)
            {
                this.owner.Insert(index, tabPage);
                this.owner.Controls.Add(tabPage);
                this.owner.tabPageCount++;
                this.owner.Controls.SetChildIndex(tabPage, index);
            }

            public void Insert(int index, object tabPage)
            {
                if (!(tabPage is XTabPage))
                {
                    throw new ArgumentException("tabPage");
                }
                this.Insert(index, (XTabPage) tabPage);
            }

            public void Insert(int index, string text)
            {
                XTabPage tabPage = new XTabPage();
                tabPage.Text = text;
                this.Insert(index, tabPage);
            }

            public void Insert(int index, string key, string text)
            {
                XTabPage tabPage = new XTabPage();
                tabPage.Name = key;
                tabPage.Text = text;
                this.Insert(index, tabPage);
            }

            public void Insert(int index, string key, string text, int imageIndex)
            {
                XTabPage tabPage = new XTabPage();
                tabPage.Name = key;
                tabPage.Text = text;
                this.Insert(index, tabPage);
                tabPage.ImageIndex = imageIndex;
            }

            public void Insert(int index, string key, string text, string imageKey)
            {
                XTabPage tabPage = new XTabPage();
                tabPage.Name = key;
                tabPage.Text = text;
                this.Insert(index, tabPage);
                tabPage.ImageKey = imageKey;
            }

            private bool IsValidIndex(int index)
            {
                if (index >= 0)
                {
                    return (index < this.Count);
                }
                return false;
            }

            public void Remove(XTabPage value)
            {
                if (value == null)
                {
                    throw new ArgumentNullException("value");
                }
                this.owner.Controls.Remove(value);
            }

            public void Remove(object value)
            {
                if (value is XTabPage)
                {
                    this.Remove((XTabPage) value);
                }
            }

            public void RemoveAt(int index)
            {
                this.owner.Controls.RemoveAt(index);
            }

            public virtual void RemoveByKey(string key)
            {
                int index = this.IndexOfKey(key);
                if (this.IsValidIndex(index))
                {
                    this.RemoveAt(index);
                }
            }

            public bool SafeCompareStrings(string strA, string strB, bool ignoreCase)
            {
                if ((strA == null) || (strB == null))
                {
                    return false;
                }
                if (strA.Length != strB.Length)
                {
                    return false;
                }
                return (string.Compare(strA, strB, ignoreCase, CultureInfo.InvariantCulture) == 0);
            }

            public int Count
            {
                get
                {
                    return this.owner.tabPageCount;
                }
            }

            public bool IsFixedSize
            {
                get
                {
                    return false;
                }
            }

            public bool IsReadOnly
            {
                get
                {
                    return false;
                }
            }

            public bool IsSynchronized
            {
                get
                {
                    return false;
                }
            }

            public virtual XTabPage this[string key]
            {
                get
                {
                    if (!string.IsNullOrEmpty(key))
                    {
                        int index = this.IndexOfKey(key);
                        if (this.IsValidIndex(index))
                        {
                            return this[index];
                        }
                    }
                    return null;
                }
            }

            public virtual XTabPage this[int i]
            {
                get
                {
                    return this.owner.GetTabPage(i);
                }
                set
                {
                    this.owner.SetTabPage(i, value);
                }
            }

            public object SyncRoot
            {
                get
                {
                    return this;
                }
            }

            object IList.this[int index]
            {
                get
                {
                    return this[index];
                }
                set
                {
                    if (!(value is XTabPage))
                    {
                        throw new ArgumentException("value");
                    }
                    this[index] = (XTabPage) value;
                }
            }
        }
    }
}

⌨️ 快捷键说明

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