コード例 #1
0
ファイル: StatusForm.cs プロジェクト: m-kosina/GEDKeeper
        protected void SetStatusLine(int index, string value)
        {
            fStatusBar.SuspendLayout();

            Label panel = null;

            if (index < 0)
            {
                return;
            }
            else if (index >= fStatusRow.Cells.Count)
            {
                while (index >= fStatusRow.Cells.Count)
                {
                    panel = new Label();
                    fStatusRow.Cells.Add(panel);
                }
            }

            panel = (Label)fStatusRow.Cells[index].Control;
            if (panel == null)
            {
                panel = new Label();
                fStatusRow.Cells[index].Control = panel;
            }
            panel.Text = value;

            for (int i = 0; i < fStatusRow.Cells.Count; i++)
            {
                fStatusRow.Cells[i].ScaleWidth = true;
            }
            //fStatusBar.Panels[fStatusBar.Panels.Count - 1].AutoSize = StatusBarPanelAutoSize.Spring;

            fStatusBar.ResumeLayout();
        }
コード例 #2
0
ファイル: LayoutSettings.cs プロジェクト: vaulthunter/sledge
        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();
        }