/// <summary>
        /// Initializes a new instance of the <see cref="ResizableControl"/> class.
        /// </summary>
        /// <param name="parent">Parent control.</param>
        public ResizableControl(Base parent)
            : base(parent)
        {
            m_Resizer = new Resizer[10];
            MinimumSize = new Point(5, 5);
            m_ClampMovement = false;

            m_Resizer[2] = new Resizer(this);
            m_Resizer[2].Dock = Pos.Bottom;
            m_Resizer[2].ResizeDir = Pos.Bottom;
            m_Resizer[2].Resized += OnResized;
            m_Resizer[2].Target = this;

            m_Resizer[1] = new Resizer(m_Resizer[2]);
            m_Resizer[1].Dock = Pos.Left;
            m_Resizer[1].ResizeDir = Pos.Bottom | Pos.Left;
            m_Resizer[1].Resized += OnResized;
            m_Resizer[1].Target = this;

            m_Resizer[3] = new Resizer(m_Resizer[2]);
            m_Resizer[3].Dock = Pos.Right;
            m_Resizer[3].ResizeDir = Pos.Bottom | Pos.Right;
            m_Resizer[3].Resized += OnResized;
            m_Resizer[3].Target = this;

            m_Resizer[8] = new Resizer(this);
            m_Resizer[8].Dock = Pos.Top;
            m_Resizer[8].ResizeDir = Pos.Top;
            m_Resizer[8].Resized += OnResized;
            m_Resizer[8].Target = this;

            m_Resizer[7] = new Resizer(m_Resizer[8]);
            m_Resizer[7].Dock = Pos.Left;
            m_Resizer[7].ResizeDir = Pos.Left | Pos.Top;
            m_Resizer[7].Resized += OnResized;
            m_Resizer[7].Target = this;

            m_Resizer[9] = new Resizer(m_Resizer[8]);
            m_Resizer[9].Dock = Pos.Right;
            m_Resizer[9].ResizeDir = Pos.Right | Pos.Top;
            m_Resizer[9].Resized += OnResized;
            m_Resizer[9].Target = this;

            m_Resizer[4] = new Resizer(this);
            m_Resizer[4].Dock = Pos.Left;
            m_Resizer[4].ResizeDir = Pos.Left;
            m_Resizer[4].Resized += OnResized;
            m_Resizer[4].Target = this;

            m_Resizer[6] = new Resizer(this);
            m_Resizer[6].Dock = Pos.Right;
            m_Resizer[6].ResizeDir = Pos.Right;
            m_Resizer[6].Resized += OnResized;
            m_Resizer[6].Target = this;
        }
Beispiel #2
0
        /// <summary>
        /// Initializes an inner docked control for the specified position.
        /// </summary>
        /// <param name="pos">Dock position.</param>
        protected virtual void SetupChildDock(Pos pos)
        {
            if (m_DockedTabControl == null)
            {
                m_DockedTabControl = new DockedTabControl(this);
                m_DockedTabControl.TabRemoved += OnTabRemoved;
                m_DockedTabControl.TabStripPosition = Pos.Bottom;
                m_DockedTabControl.TitleBarVisible = true;
            }

            Dock = pos;

            Pos sizeDir;
            if (pos == Pos.Right) sizeDir = Pos.Left;
            else if (pos == Pos.Left) sizeDir = Pos.Right;
            else if (pos == Pos.Top) sizeDir = Pos.Bottom;
            else if (pos == Pos.Bottom) sizeDir = Pos.Top;
            else throw new ArgumentException("Invalid dock", "pos");

            if (m_Sizer != null)
                m_Sizer.Dispose();
            m_Sizer = new Resizer(this);
            m_Sizer.Dock = sizeDir;
            m_Sizer.ResizeDir = sizeDir;
            m_Sizer.SetSize(2, 2);
        }