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

📄 xtabpagedesigner.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Pc.XControls
{
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Windows.Forms;
    using System.Windows.Forms.Design;
    using System.Windows.Forms.Design.Behavior;

    public class XTabPageDesigner : ParentControlDesigner
    {
        private XTabPage _xTabPage;

        public XTabPageDesigner()
        {
            base.AutoResizeHandles = true;
        }

        public override bool CanBeParentedTo(IDesigner parentDesigner)
        {
            if (parentDesigner != null)
            {
                return (parentDesigner.Component is XTabControl);
            }
            return false;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                ISelectionService service = this.GetService(typeof(ISelectionService)) as ISelectionService;
                service.SelectionChanged -= new EventHandler(this.service_SelectionChanged);
            }
            base.Dispose(disposing);
        }

        protected virtual void DrawBorder(Graphics graphics)
        {
            Panel component = (Panel) base.Component;
            if ((component != null) && component.Visible)
            {
                Pen borderPen = this.BorderPen;
                Rectangle rect = this.Control.ClientRectangle;
                rect.Width--;
                rect.Height--;
                graphics.DrawRectangle(borderPen, rect);
                borderPen.Dispose();
            }
        }

        protected override ControlBodyGlyph GetControlGlyph(GlyphSelectionType selectionType)
        {
            this.OnSetCursor();
            return new ControlBodyGlyph(Rectangle.Empty, Cursor.Current, this.Control, this);
        }

        public override void Initialize(IComponent component)
        {
            base.Initialize(component);
            this._xTabPage = component as XTabPage;
            if (this._xTabPage != null)
            {
                ISelectionService service = this.GetService(typeof(ISelectionService)) as ISelectionService;
                service.SelectionChanged += new EventHandler(this.service_SelectionChanged);
            }
        }

        internal void OnDragDropInternal(DragEventArgs de)
        {
            this.OnDragDrop(de);
        }

        internal void OnDragEnterInternal(DragEventArgs de)
        {
            this.OnDragEnter(de);
        }

        internal void OnDragLeaveInternal(EventArgs de)
        {
            this.OnDragLeave(de);
        }

        internal void OnDragOverInternal(DragEventArgs de)
        {
            this.OnDragOver(de);
        }

        private void service_SelectionChanged(object sender, EventArgs e)
        {
            ICollection selectedComponents = (this.GetService(typeof(ISelectionService)) as ISelectionService).GetSelectedComponents();
            if (!this._xTabPage.Selected)
            {
                foreach (IComponent component in selectedComponents)
                {
                    if (component == this._xTabPage)
                    {
                        this._xTabPage.Selected = true;
                        this._xTabPage.Parent.Invalidate();
                        return;
                    }
                }
            }
            this._xTabPage.Selected = false;
            this._xTabPage.Parent.Invalidate();
        }

        protected Pen BorderPen
        {
            get
            {
                Color color = (this.Control.BackColor.GetBrightness() < 0.5) ? ControlPaint.Light(this.Control.BackColor) : ControlPaint.Dark(this.Control.BackColor);
                Pen pen = new Pen(color);
                pen.DashStyle = DashStyle.Dash;
                return pen;
            }
        }

        public override System.Windows.Forms.Design.SelectionRules SelectionRules
        {
            get
            {
                System.Windows.Forms.Design.SelectionRules selectionRules = base.SelectionRules;
                if (this.Control.Parent is XTabControl)
                {
                    selectionRules &= ~System.Windows.Forms.Design.SelectionRules.AllSizeable;
                }
                return selectionRules;
            }
        }
    }
}

⌨️ 快捷键说明

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