Server/MainForm.cs
changeset 63 cd9924457275
parent 62 ac698f4e1b36
child 65 464486b81635
     1.1 --- a/Server/MainForm.cs	Mon Sep 22 16:04:26 2014 +0200
     1.2 +++ b/Server/MainForm.cs	Mon Sep 22 17:23:35 2014 +0200
     1.3 @@ -776,7 +776,7 @@
     1.4                  if (client != null)
     1.5                  {
     1.6                      client.Layout = aLayout;
     1.7 -                    UpdateTableLayoutPanel(client.Layout.ColumnCount, client.Layout.RowCount);
     1.8 +                    UpdateTableLayoutPanel(client.Layout);
     1.9                      //
    1.10                      UpdateClientTreeViewNode(client);
    1.11                  }
    1.12 @@ -1064,6 +1064,68 @@
    1.13              CheckFontHeight();
    1.14          }
    1.15  
    1.16 +
    1.17 +        /// <summary>
    1.18 +        /// Update our display table layout.
    1.19 +        /// </summary>
    1.20 +        /// <param name="aLayout"></param>
    1.21 +        private void UpdateTableLayoutPanel(TableLayout aLayout)
    1.22 +        {
    1.23 +            tableLayoutPanel.Controls.Clear();
    1.24 +            tableLayoutPanel.RowStyles.Clear();
    1.25 +            tableLayoutPanel.ColumnStyles.Clear();
    1.26 +            tableLayoutPanel.RowCount = 0;
    1.27 +            tableLayoutPanel.ColumnCount = 0;
    1.28 +
    1.29 +            while (tableLayoutPanel.RowCount < aLayout.Rows.Count)
    1.30 +            {
    1.31 +                tableLayoutPanel.RowCount++;
    1.32 +            }
    1.33 +
    1.34 +            while (tableLayoutPanel.ColumnCount < aLayout.Columns.Count)
    1.35 +            {
    1.36 +                tableLayoutPanel.ColumnCount++;
    1.37 +            }
    1.38 +
    1.39 +            for (int i = 0; i < tableLayoutPanel.ColumnCount; i++)
    1.40 +            {
    1.41 +                //Create our column styles
    1.42 +                this.tableLayoutPanel.ColumnStyles.Add(aLayout.Columns[i]);
    1.43 +
    1.44 +                for (int j = 0; j < tableLayoutPanel.RowCount; j++)
    1.45 +                {
    1.46 +                    if (i == 0)
    1.47 +                    {
    1.48 +                        //Create our row styles
    1.49 +                        this.tableLayoutPanel.RowStyles.Add(aLayout.Rows[j]);
    1.50 +                    }
    1.51 +
    1.52 +                    MarqueeLabel control = new SharpDisplayManager.MarqueeLabel();
    1.53 +                    control.AutoEllipsis = true;
    1.54 +                    control.AutoSize = true;
    1.55 +                    control.BackColor = System.Drawing.Color.Transparent;
    1.56 +                    control.Dock = System.Windows.Forms.DockStyle.Fill;
    1.57 +                    control.Location = new System.Drawing.Point(1, 1);
    1.58 +                    control.Margin = new System.Windows.Forms.Padding(0);
    1.59 +                    control.Name = "marqueeLabelCol" + aLayout.Columns.Count + "Row" + aLayout.Rows.Count;
    1.60 +                    control.OwnTimer = false;
    1.61 +                    control.PixelsPerSecond = 64;
    1.62 +                    control.Separator = "|";
    1.63 +                    //control.Size = new System.Drawing.Size(254, 30);
    1.64 +                    //control.TabIndex = 2;
    1.65 +                    control.Font = cds.Font;
    1.66 +                    control.Text = "ABCDEFGHIJKLMNOPQRST[0123456789]";
    1.67 +                    control.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    1.68 +                    control.UseCompatibleTextRendering = true;
    1.69 +                    //
    1.70 +                    tableLayoutPanel.Controls.Add(control, i, j);
    1.71 +                }
    1.72 +            }
    1.73 +
    1.74 +            CheckFontHeight();
    1.75 +        }
    1.76 +
    1.77 +
    1.78          private void buttonAlignLeft_Click(object sender, EventArgs e)
    1.79          {
    1.80              foreach (MarqueeLabel ctrl in tableLayoutPanel.Controls)