Example #1
0
        void UpdateLayout()
        {
            if (header != null)
            {
                int       space = 2;
                Rectangle rect  = new Rectangle(0, 0, ClientRectangle.Width, space + space + SystemInformation.MenuHeight);
                header.Bounds = rect; //.SetBounds(rect.Left, rect.Top, rect.Width, 32);
                int cy = 1 + ((rect.Height - label.Height) / 2);
                label.SetBounds(0, cy, label.Width, label.Height);
                tree.SetBounds(0, header.Bottom, ClientRectangle.Width, ClientRectangle.Height - header.Bottom);
                if (parseTree != null)
                {
                    parseTree.SetBounds(0, header.Bottom, ClientRectangle.Width, ClientRectangle.Height - header.Bottom);
                }

                rect = new Rectangle(rect.Left, space, rect.Width, rect.Height - (space + space));
                int size = rect.Height;
                foreach (Control b in buttons)
                {
                    b.SetBounds(rect.Right - size, rect.Top, size, size);
                    rect.Width -= size;
                }
                bool showing = parseTreeButtons.Count > 0 && parseTree.Visible;
                if (showing)
                {
                    rect.Width -= size;
                }
                foreach (Control b in parseTreeButtons)
                {
                    b.Visible = parseTree.Visible;
                    if (showing)
                    {
                        b.SetBounds(rect.Right - size, rect.Top, size, size);
                        rect.Width -= size + space + space + space;
                    }
                }
                rect.Width -= size / 2;
                size        = searchTextBox.Height;
                cy          = (rect.Height - searchTextBox.Height) / 2;
                xButton.SetBounds(rect.Right - size, rect.Top + cy, size, size);
                rect.Width -= size;
                int width = Math.Min(200, rect.Width - (label.Width + 10));
                xButton.Visible = searchTextBox.Visible = Name == "allObjectsTree" && width > 100;
                if (searchTextBox.Visible)
                {
                    searchTextBox.SetBounds(rect.Right - (width), rect.Top + cy, width, searchTextBox.Height);
                }
            }
        }