Font height now also checked on startup.
authorsl
Tue, 19 Aug 2014 21:26:17 +0200
changeset 37405a2590eda4
parent 36 a3aa661da810
child 38 babab407f2bb
Font height now also checked on startup.
Server/MainForm.Designer.cs
Server/MainForm.cs
     1.1 --- a/Server/MainForm.Designer.cs	Tue Aug 19 17:29:52 2014 +0200
     1.2 +++ b/Server/MainForm.Designer.cs	Tue Aug 19 21:26:17 2014 +0200
     1.3 @@ -31,6 +31,8 @@
     1.4              this.components = new System.ComponentModel.Container();
     1.5              this.panelDisplay = new System.Windows.Forms.Panel();
     1.6              this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
     1.7 +            this.marqueeLabelTop = new SharpDisplayManager.MarqueeLabel();
     1.8 +            this.marqueeLabelBottom = new SharpDisplayManager.MarqueeLabel();
     1.9              this.fontDialog = new System.Windows.Forms.FontDialog();
    1.10              this.timer = new System.Windows.Forms.Timer(this.components);
    1.11              this.statusStrip = new System.Windows.Forms.StatusStrip();
    1.12 @@ -43,6 +45,7 @@
    1.13              this.buttonStartClient = new System.Windows.Forms.Button();
    1.14              this.treeViewClients = new System.Windows.Forms.TreeView();
    1.15              this.tabPageDisplay = new System.Windows.Forms.TabPage();
    1.16 +            this.labelWarning = new System.Windows.Forms.Label();
    1.17              this.checkBoxFixedPitchFontOnly = new System.Windows.Forms.CheckBox();
    1.18              this.buttonSuspend = new System.Windows.Forms.Button();
    1.19              this.checkBoxReverseScreen = new System.Windows.Forms.CheckBox();
    1.20 @@ -56,9 +59,6 @@
    1.21              this.buttonCapture = new System.Windows.Forms.Button();
    1.22              this.buttonFont = new System.Windows.Forms.Button();
    1.23              this.tabControl = new System.Windows.Forms.TabControl();
    1.24 -            this.labelWarning = new System.Windows.Forms.Label();
    1.25 -            this.marqueeLabelTop = new SharpDisplayManager.MarqueeLabel();
    1.26 -            this.marqueeLabelBottom = new SharpDisplayManager.MarqueeLabel();
    1.27              this.panelDisplay.SuspendLayout();
    1.28              this.tableLayoutPanel.SuspendLayout();
    1.29              this.statusStrip.SuspendLayout();
    1.30 @@ -154,6 +154,39 @@
    1.31              this.tableLayoutPanel.Size = new System.Drawing.Size(256, 64);
    1.32              this.tableLayoutPanel.TabIndex = 5;
    1.33              // 
    1.34 +            // marqueeLabelTop
    1.35 +            // 
    1.36 +            this.marqueeLabelTop.AutoEllipsis = true;
    1.37 +            this.marqueeLabelTop.BackColor = System.Drawing.Color.Transparent;
    1.38 +            this.marqueeLabelTop.Dock = System.Windows.Forms.DockStyle.Fill;
    1.39 +            this.marqueeLabelTop.Location = new System.Drawing.Point(1, 1);
    1.40 +            this.marqueeLabelTop.Margin = new System.Windows.Forms.Padding(0);
    1.41 +            this.marqueeLabelTop.Name = "marqueeLabelTop";
    1.42 +            this.marqueeLabelTop.OwnTimer = false;
    1.43 +            this.marqueeLabelTop.PixelsPerSecond = 64;
    1.44 +            this.marqueeLabelTop.Separator = "|";
    1.45 +            this.marqueeLabelTop.Size = new System.Drawing.Size(254, 30);
    1.46 +            this.marqueeLabelTop.TabIndex = 2;
    1.47 +            this.marqueeLabelTop.Text = "ABCDEFGHIJKLMNOPQRST-0123456789";
    1.48 +            this.marqueeLabelTop.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    1.49 +            this.marqueeLabelTop.UseCompatibleTextRendering = true;
    1.50 +            // 
    1.51 +            // marqueeLabelBottom
    1.52 +            // 
    1.53 +            this.marqueeLabelBottom.AutoEllipsis = true;
    1.54 +            this.marqueeLabelBottom.Dock = System.Windows.Forms.DockStyle.Fill;
    1.55 +            this.marqueeLabelBottom.Location = new System.Drawing.Point(1, 32);
    1.56 +            this.marqueeLabelBottom.Margin = new System.Windows.Forms.Padding(0);
    1.57 +            this.marqueeLabelBottom.Name = "marqueeLabelBottom";
    1.58 +            this.marqueeLabelBottom.OwnTimer = false;
    1.59 +            this.marqueeLabelBottom.PixelsPerSecond = 64;
    1.60 +            this.marqueeLabelBottom.Separator = "|";
    1.61 +            this.marqueeLabelBottom.Size = new System.Drawing.Size(254, 31);
    1.62 +            this.marqueeLabelBottom.TabIndex = 3;
    1.63 +            this.marqueeLabelBottom.Text = "abcdefghijklmnopqrst-0123456789";
    1.64 +            this.marqueeLabelBottom.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    1.65 +            this.marqueeLabelBottom.UseCompatibleTextRendering = true;
    1.66 +            // 
    1.67              // timer
    1.68              // 
    1.69              this.timer.Enabled = true;
    1.70 @@ -267,6 +300,19 @@
    1.71              this.tabPageDisplay.Text = "Display";
    1.72              this.tabPageDisplay.UseVisualStyleBackColor = true;
    1.73              // 
    1.74 +            // labelWarning
    1.75 +            // 
    1.76 +            this.labelWarning.AutoSize = true;
    1.77 +            this.labelWarning.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    1.78 +            this.labelWarning.ForeColor = System.Drawing.Color.Red;
    1.79 +            this.labelWarning.Location = new System.Drawing.Point(87, 9);
    1.80 +            this.labelWarning.Name = "labelWarning";
    1.81 +            this.labelWarning.Size = new System.Drawing.Size(80, 16);
    1.82 +            this.labelWarning.TabIndex = 18;
    1.83 +            this.labelWarning.Text = "WARNING";
    1.84 +            this.labelWarning.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    1.85 +            this.labelWarning.Visible = false;
    1.86 +            // 
    1.87              // checkBoxFixedPitchFontOnly
    1.88              // 
    1.89              this.checkBoxFixedPitchFontOnly.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    1.90 @@ -413,52 +459,6 @@
    1.91              this.tabControl.Size = new System.Drawing.Size(600, 343);
    1.92              this.tabControl.TabIndex = 0;
    1.93              // 
    1.94 -            // labelWarning
    1.95 -            // 
    1.96 -            this.labelWarning.AutoSize = true;
    1.97 -            this.labelWarning.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    1.98 -            this.labelWarning.ForeColor = System.Drawing.Color.Red;
    1.99 -            this.labelWarning.Location = new System.Drawing.Point(87, 9);
   1.100 -            this.labelWarning.Name = "labelWarning";
   1.101 -            this.labelWarning.Size = new System.Drawing.Size(80, 16);
   1.102 -            this.labelWarning.TabIndex = 18;
   1.103 -            this.labelWarning.Text = "WARNING";
   1.104 -            this.labelWarning.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   1.105 -            this.labelWarning.Visible = false;
   1.106 -            // 
   1.107 -            // marqueeLabelTop
   1.108 -            // 
   1.109 -            this.marqueeLabelTop.AutoEllipsis = true;
   1.110 -            this.marqueeLabelTop.BackColor = System.Drawing.Color.Transparent;
   1.111 -            this.marqueeLabelTop.Dock = System.Windows.Forms.DockStyle.Fill;
   1.112 -            this.marqueeLabelTop.Location = new System.Drawing.Point(1, -124);
   1.113 -            this.marqueeLabelTop.Margin = new System.Windows.Forms.Padding(0);
   1.114 -            this.marqueeLabelTop.Name = "marqueeLabelTop";
   1.115 -            this.marqueeLabelTop.OwnTimer = false;
   1.116 -            this.marqueeLabelTop.PixelsPerSecond = 64;
   1.117 -            this.marqueeLabelTop.Separator = "|";
   1.118 -            this.marqueeLabelTop.Size = new System.Drawing.Size(254, 20);
   1.119 -            this.marqueeLabelTop.TabIndex = 2;
   1.120 -            this.marqueeLabelTop.Text = "ABCDEFGHIJKLMNOPQRST-0123456789";
   1.121 -            this.marqueeLabelTop.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   1.122 -            this.marqueeLabelTop.UseCompatibleTextRendering = true;
   1.123 -            // 
   1.124 -            // marqueeLabelBottom
   1.125 -            // 
   1.126 -            this.marqueeLabelBottom.AutoEllipsis = true;
   1.127 -            this.marqueeLabelBottom.Dock = System.Windows.Forms.DockStyle.Fill;
   1.128 -            this.marqueeLabelBottom.Location = new System.Drawing.Point(1, -40);
   1.129 -            this.marqueeLabelBottom.Margin = new System.Windows.Forms.Padding(0);
   1.130 -            this.marqueeLabelBottom.Name = "marqueeLabelBottom";
   1.131 -            this.marqueeLabelBottom.OwnTimer = false;
   1.132 -            this.marqueeLabelBottom.PixelsPerSecond = 64;
   1.133 -            this.marqueeLabelBottom.Separator = "|";
   1.134 -            this.marqueeLabelBottom.Size = new System.Drawing.Size(254, 20);
   1.135 -            this.marqueeLabelBottom.TabIndex = 3;
   1.136 -            this.marqueeLabelBottom.Text = "abcdefghijklmnopqrst-0123456789";
   1.137 -            this.marqueeLabelBottom.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   1.138 -            this.marqueeLabelBottom.UseCompatibleTextRendering = true;
   1.139 -            // 
   1.140              // MainForm
   1.141              // 
   1.142              this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     2.1 --- a/Server/MainForm.cs	Tue Aug 19 17:29:52 2014 +0200
     2.2 +++ b/Server/MainForm.cs	Tue Aug 19 21:26:17 2014 +0200
     2.3 @@ -59,6 +59,11 @@
     2.4          {
     2.5              StartServer();
     2.6  
     2.7 +            //
     2.8 +            CheckFontHeight();
     2.9 +            //
    2.10 +
    2.11 +
    2.12              if (Properties.Settings.Default.DisplayConnectOnStartup)
    2.13              {
    2.14                  iDisplay.Open();
    2.15 @@ -98,17 +103,25 @@
    2.16                  Properties.Settings.Default.DisplayFont = fontDialog.Font;
    2.17                  Properties.Settings.Default.Save();
    2.18                  //
    2.19 -                if (fontDialog.Font.Height > marqueeLabelBottom.Height)
    2.20 -                {
    2.21 -                    labelWarning.Text = "WARNING: Selected font is too height by " + (fontDialog.Font.Height - marqueeLabelBottom.Height) + " pixels!";
    2.22 -                    labelWarning.Visible = true;
    2.23 -                }
    2.24 -                else
    2.25 -                {
    2.26 -                    labelWarning.Visible = false;
    2.27 -                }
    2.28 +                CheckFontHeight();
    2.29 +            }
    2.30 +        }
    2.31  
    2.32 +        /// <summary>
    2.33 +        /// 
    2.34 +        /// </summary>
    2.35 +        void CheckFontHeight()
    2.36 +        {
    2.37 +            if (marqueeLabelBottom.Font.Height > marqueeLabelBottom.Height)
    2.38 +            {
    2.39 +                labelWarning.Text = "WARNING: Selected font is too height by " + (marqueeLabelBottom.Font.Height - marqueeLabelBottom.Height) + " pixels!";
    2.40 +                labelWarning.Visible = true;
    2.41              }
    2.42 +            else
    2.43 +            {
    2.44 +                labelWarning.Visible = false;
    2.45 +            }
    2.46 +
    2.47          }
    2.48  
    2.49          private void buttonCapture_Click(object sender, EventArgs e)