public ToolBox()
            {
                miShrink.Anchor = AnchorStyles.Left | AnchorStyles.Right;
                miFill.Anchor   = AnchorStyles.Left | AnchorStyles.Right;
                miLock.Anchor   = AnchorStyles.Left | AnchorStyles.Right;

                this.Items.Add(miShrink);
                this.Items.Add(miFill);
                this.Items.Add(miLock);

                this.DropShadowEnabled = false;
                this.BackColor         = Color.Transparent;
                this.Padding           = new Padding(0, 2, 1, 2); // remove extra left pixel on left side

                miFill.Click += delegate {
                    FlowLayoutPanel2 host = (FlowLayoutPanel2)Current.Parent;
                    foreach (Control c in host.Controls)
                    {
                        if (c is Control2)
                        {
                            Control2 c2 = (Control2)c;
                            if (!c2.isLocked)
                            {
                                c2.dh = 0;
                            }
                        }
                    }
                    Current.lastClicked = DateTime.Now;
                    bool origLocked = Current.isLocked;
                    Current.isLocked = false;
                    host.UpdateDeltaHeights();
                    Current.isLocked = origLocked;
                    host.PerformLayout();
                };

                miShrink.Click += delegate {
                    Current.dh          = 0;
                    Current.lastClicked = DateTime.MinValue;
                    FlowLayoutPanel2 host       = (FlowLayoutPanel2)Current.Parent;
                    bool             origLocked = Current.isLocked;
                    Current.isLocked = true;
                    host.UpdateDeltaHeights();
                    Current.isLocked = origLocked;
                    host.PerformLayout();
                };

                miLock.Click += delegate {
                    Current.isLocked = !Current.isLocked;
                    FlowLayoutPanel2 host = (FlowLayoutPanel2)Current.Parent;
                    host.UpdateDeltaHeights();
                    host.PerformLayout();
                };
            }
            public override Size GetPreferredSize(Size proposedSize)
            {
                if (!cb.Checked)
                {
                    return(Size.Empty);
                }
                Size             s  = c.GetPreferredSize(proposedSize);
                var              pd = this.Padding;
                FlowLayoutPanel2 p  = (FlowLayoutPanel2)this.Parent;

                s.Width  += pd.Left + pd.Right;
                s.Height += pd.Top + pd.Bottom + (p.addDH ? dh : 0);
                return(s);
            }
            protected override void OnMouseMove(MouseEventArgs e)
            {
                base.OnMouseMove(e);

                FlowLayoutPanel2 p   = (FlowLayoutPanel2)this.Parent;
                Accordion        acc = (Accordion)p.Parent;

                if (!acc.AllowMouseResize)
                {
                    return;
                }

                // PerformLayout causes the control to move which triggers a MouseMove
                // even though the mouse didn't move. Thus, the absolute location is
                // used to determine if the mouse actually moved. There is probably a
                // better way to handle the resizing.
                Point pt = this.PointToScreen(e.Location);

                if (oldPoint == pt)
                {
                    return;
                }
                oldPoint = pt;

                if (isGrabbing)
                {
                    int dy = pt.Y - grabPoint.Y;
                    dh = Math.Max(0, dhOrig + dy);
                    p.UpdateDeltaHeights();
                    p.PerformLayout();
                    resetLocked = false;
                }
                else
                {
                    int by = this.Height - e.Y;
                    if (by < this.Padding.Bottom)
                    {
                        this.Cursor = cursorResize;
                    }
                    else
                    {
                        this.Cursor = this.DefaultCursor;
                    }
                }
            }
            public override Size GetPreferredSize(Size proposedSize)
            {
                if (!cb.Checked)
                {
                    return(Size.Empty);
                }
                Size s = c.GetPreferredSize(proposedSize);
                var  p = this.Padding;

                s.Width  += p.Left + p.Right;
                s.Height += p.Top + p.Bottom + dh;
                FlowLayoutPanel2 p2 = (FlowLayoutPanel2)this.Parent;

                if (flag || !fillHeight || p2.isAdjusting)
                {
                    return(s);
                }

                foreach (Control cc in p2.Controls)
                {
                    if (cc is Control2)
                    {
                        if (((Control2)cc).lastClicked > this.lastClicked)
                        {
                            return(s);
                        }
                    }
                }

                flag = true;
                var r  = p2.GetPreferredSize(proposedSize);
                int h1 = p2.Height;

                dh        = Math.Max(h1 - r.Height, 0);
                flag      = false;
                s.Height += dh;

                return(s);
            }