ComponentFactory.Krypton.Docking.DockingHelper.InnerRectangle C# (CSharp) Method

InnerRectangle() public static method

Find the inner space that occupied by the edge docking controls.
public static InnerRectangle ( Control c ) : Rectangle
c System.Windows.Forms.Control Reference to control.
return System.Drawing.Rectangle
        public static Rectangle InnerRectangle(Control c)
        {
            // Start with entire client area
            Rectangle inner = c.ClientRectangle;

            // Adjust for edge docked controls
            foreach (Control child in c.Controls)
            {
                if (child.Visible)
                {
                    switch (child.Dock)
                    {
                        case DockStyle.Left:
                            inner.Width -= child.Width;
                            inner.X += child.Width;
                            break;
                        case DockStyle.Right:
                            inner.Width -= child.Width;
                            break;
                        case DockStyle.Top:
                            inner.Height -= child.Height;
                            inner.Y += child.Height;
                            break;
                        case DockStyle.Bottom:
                            inner.Height -= child.Height;
                            break;
                    }
                }
            }

            return inner;
        }

Usage Example

Example #1
0
        private void EnforceInnerMinimum()
        {
            // Find the available inner rectangle of our containing control
            Rectangle innerRect = DockingHelper.InnerRectangle(Control);

            // Do we need to adjust the left/right edge controls?
            if (innerRect.Width < InnerMinimum.Width)
            {
                EnforceInnerMinimum(InnerMinimum.Width - innerRect.Width, Orientation.Horizontal);
            }

            // Do we need to adjust the top/bottom edge controls?
            if (innerRect.Height < InnerMinimum.Height)
            {
                EnforceInnerMinimum(InnerMinimum.Height - innerRect.Height, Orientation.Vertical);
            }
        }
All Usage Examples Of ComponentFactory.Krypton.Docking.DockingHelper::InnerRectangle