예제 #1
0
        private void UpdateTableLayout()
        {
            FixRectangles(SelectedConfiguration.Configuration);

            TableLayout.SuspendLayout();

            TableLayout.ColumnCount = (int)Columns.Value;
            TableLayout.ColumnStyles.Clear();
            for (var i = 0; i < TableLayout.ColumnCount; i++)
            {
                TableLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f / TableLayout.ColumnCount));
            }

            TableLayout.RowCount = (int)Rows.Value;
            TableLayout.RowStyles.Clear();
            for (var i = 0; i < TableLayout.RowCount; i++)
            {
                TableLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100f / TableLayout.RowCount));
            }

            foreach (Control panel in TableLayout.Controls)
            {
                UnregisterPanel(panel);
            }
            TableLayout.Controls.Clear();

            foreach (var rec in SelectedConfiguration.Configuration.Rectangles)
            {
                var panel = new Panel {
                    BackColor = Color.Black, Dock = DockStyle.Fill
                };
                TableLayout.Controls.Add(panel, rec.X, rec.Y);
                TableLayout.SetColumnSpan(panel, rec.Width);
                TableLayout.SetRowSpan(panel, rec.Height);
                RegisterPanel(panel);
            }

            TableLayout.ResumeLayout();
        }
예제 #2
0
        private void UpdateTableLayout()
        {
            FixRectangles(SelectedConfiguration.Configuration);

            TableLayout.ColumnCount = (int)Columns.Value;
            TableLayout.ColumnStyles.Clear();
            for (var i = 0; i < TableLayout.ColumnCount; i++)
            {
                TableLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f / TableLayout.ColumnCount));
            }

            TableLayout.RowCount = (int)Rows.Value;
            TableLayout.RowStyles.Clear();
            for (var i = 0; i < TableLayout.RowCount; i++)
            {
                TableLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100f / TableLayout.RowCount));
            }

            foreach (Control panel in TableLayout.Controls)
            {
                UnregisterPanel(panel);
            }
            TableLayout.Controls.Clear();

            var counter = 0;

            foreach (var rec in SelectedConfiguration.Configuration.Rectangles)
            {
                var panel = new Panel();
                panel.BackColor = Chisel.Settings.View.ViewportBackground;
                panel.Dock      = DockStyle.Fill;
                TableLayout.Controls.Add(panel, rec.X, rec.Y);
                TableLayout.SetColumnSpan(panel, rec.Width);
                TableLayout.SetRowSpan(panel, rec.Height);
                RegisterPanel(panel);
                counter += 1;
            }
        }