Adjust: Larger font, place for graphics

This commit is contained in:
Milan Hanajik
2015-01-28 20:57:03 +01:00
parent 94accbf58b
commit 5653628bf7
2 changed files with 58 additions and 36 deletions
@@ -1,4 +1,5 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using TBF.Resources;
@@ -9,8 +10,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
/// <summary> Number of text boxes for serial numbers </summary>
public readonly int WaterMetersCount;
// To be retrieved after the form closes
public float[] WMState;
Entities.TestResult tr;
// Set to 'true' when the form closes
public bool Completed { get { return completed; } }
@@ -24,14 +24,10 @@ namespace TBF.BenchControl.TestMethods.Adjustment
{
this.WaterMetersCount = waterMetersCount;
InitializeComponent();
WMState = new float[WaterMetersCount];
completed = false;
}
tr = null;
/// <summary> Parameterless constructor for 3 watermeters </summary>
public WMErrorsForm()
: this(Program.WMsCount)
{
/// Attach to 'AdjustmentInProgress' handler
UiBridge.Bridge.AdjustmentInProgressHandler += delegate(object sender, UiBridge.AdjustmentInProgressEventArgs args)
{
if (InvokeRequired)
@@ -42,6 +38,12 @@ namespace TBF.BenchControl.TestMethods.Adjustment
};
}
/// <summary> Parameterless constructor for 3 watermeters </summary>
public WMErrorsForm()
: this(Program.WMsCount)
{
}
void Localize()
{
Text = Strings.Water_Meter_States;
@@ -64,7 +66,7 @@ namespace TBF.BenchControl.TestMethods.Adjustment
{
Localize();
Height = 195 + 90 * WaterMetersCount;
Height = 50 + 90 * WaterMetersCount;
if (WaterMetersCount < 1) groupBox1.Visible = false;
if (WaterMetersCount < 2) groupBox2.Visible = false;
@@ -83,13 +85,21 @@ namespace TBF.BenchControl.TestMethods.Adjustment
void OnAdjustmentInProgress(object sender, UiBridge.AdjustmentInProgressEventArgs args)
{
Entities.TestResult tr = args.TestResult;
if (WaterMetersCount >= 1) wmErrorTextBox1.Text = tr.Meters[0].VolumeErrorPct.ToString("F1");
if (WaterMetersCount >= 2) wmErrorTextBox2.Text = tr.Meters[1].VolumeErrorPct.ToString("F1");
if (WaterMetersCount >= 3) wmErrorTextBox3.Text = tr.Meters[2].VolumeErrorPct.ToString("F1");
if (WaterMetersCount >= 4) wmErrorTextBox4.Text = tr.Meters[3].VolumeErrorPct.ToString("F1");
if (WaterMetersCount >= 5) wmErrorTextBox5.Text = tr.Meters[4].VolumeErrorPct.ToString("F1");
if (WaterMetersCount >= 6) wmErrorTextBox6.Text = tr.Meters[5].VolumeErrorPct.ToString("F1");
tr = args.TestResult;
}
void Redraw()
{
if (tr != null)
{
if (WaterMetersCount >= 1) wmErrorTextBox1.Text = tr.Meters[0].VolumeErrorPct.ToString("F1");
if (WaterMetersCount >= 2) wmErrorTextBox2.Text = tr.Meters[1].VolumeErrorPct.ToString("F1");
if (WaterMetersCount >= 3) wmErrorTextBox3.Text = tr.Meters[2].VolumeErrorPct.ToString("F1");
if (WaterMetersCount >= 4) wmErrorTextBox4.Text = tr.Meters[3].VolumeErrorPct.ToString("F1");
if (WaterMetersCount >= 5) wmErrorTextBox5.Text = tr.Meters[4].VolumeErrorPct.ToString("F1");
if (WaterMetersCount >= 6) wmErrorTextBox6.Text = tr.Meters[5].VolumeErrorPct.ToString("F1");
}
Invalidate(new Rectangle(380, 30, 330, 500));
}
private void okButton_Click(object sender, EventArgs e)
@@ -97,5 +107,10 @@ namespace TBF.BenchControl.TestMethods.Adjustment
completed = true;
Close();
}
private void WMErrorsForm_Paint(object sender, PaintEventArgs e)
{
}
}
}
@@ -63,16 +63,17 @@
this.groupBox2.ForeColor = System.Drawing.Color.Black;
this.groupBox2.Location = new System.Drawing.Point(25, 102);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(362, 81);
this.groupBox2.Size = new System.Drawing.Size(333, 81);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Water Meter 2";
//
// wmErrorTextBox2
//
this.wmErrorTextBox2.Location = new System.Drawing.Point(183, 31);
this.wmErrorTextBox2.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox2.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox2.Name = "wmErrorTextBox2";
this.wmErrorTextBox2.Size = new System.Drawing.Size(163, 31);
this.wmErrorTextBox2.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox2.TabIndex = 1;
//
// wmErrorLabel2
@@ -92,16 +93,17 @@
this.groupBox1.ForeColor = System.Drawing.Color.Black;
this.groupBox1.Location = new System.Drawing.Point(25, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(362, 81);
this.groupBox1.Size = new System.Drawing.Size(333, 81);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Water Meter 1";
//
// wmErrorTextBox1
//
this.wmErrorTextBox1.Location = new System.Drawing.Point(183, 31);
this.wmErrorTextBox1.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox1.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox1.Name = "wmErrorTextBox1";
this.wmErrorTextBox1.Size = new System.Drawing.Size(163, 31);
this.wmErrorTextBox1.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox1.TabIndex = 1;
//
// wmErrorLabel1
@@ -117,7 +119,7 @@
//
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.okButton.ForeColor = System.Drawing.Color.Black;
this.okButton.Location = new System.Drawing.Point(425, 21);
this.okButton.Location = new System.Drawing.Point(739, 26);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(98, 63);
this.okButton.TabIndex = 7;
@@ -133,16 +135,17 @@
this.groupBox3.ForeColor = System.Drawing.Color.Black;
this.groupBox3.Location = new System.Drawing.Point(25, 192);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(362, 81);
this.groupBox3.Size = new System.Drawing.Size(333, 81);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Water Meter 3";
//
// wmErrorTextBox3
//
this.wmErrorTextBox3.Location = new System.Drawing.Point(183, 31);
this.wmErrorTextBox3.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox3.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox3.Name = "wmErrorTextBox3";
this.wmErrorTextBox3.Size = new System.Drawing.Size(163, 31);
this.wmErrorTextBox3.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox3.TabIndex = 1;
//
// wmErrorLabel3
@@ -162,16 +165,17 @@
this.groupBox4.ForeColor = System.Drawing.Color.Black;
this.groupBox4.Location = new System.Drawing.Point(25, 282);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(362, 81);
this.groupBox4.Size = new System.Drawing.Size(333, 81);
this.groupBox4.TabIndex = 4;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Water Meter 4";
//
// wmErrorTextBox4
//
this.wmErrorTextBox4.Location = new System.Drawing.Point(183, 31);
this.wmErrorTextBox4.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox4.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox4.Name = "wmErrorTextBox4";
this.wmErrorTextBox4.Size = new System.Drawing.Size(163, 31);
this.wmErrorTextBox4.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox4.TabIndex = 1;
//
// wmErrorLabel4
@@ -191,16 +195,17 @@
this.groupBox5.ForeColor = System.Drawing.Color.Black;
this.groupBox5.Location = new System.Drawing.Point(25, 372);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(362, 81);
this.groupBox5.Size = new System.Drawing.Size(333, 81);
this.groupBox5.TabIndex = 5;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Water Meter 5";
//
// wmErrorTextBox5
//
this.wmErrorTextBox5.Location = new System.Drawing.Point(183, 31);
this.wmErrorTextBox5.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox5.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox5.Name = "wmErrorTextBox5";
this.wmErrorTextBox5.Size = new System.Drawing.Size(163, 31);
this.wmErrorTextBox5.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox5.TabIndex = 1;
//
// wmErrorLabel5
@@ -220,16 +225,17 @@
this.groupBox6.ForeColor = System.Drawing.Color.Black;
this.groupBox6.Location = new System.Drawing.Point(25, 462);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(362, 81);
this.groupBox6.Size = new System.Drawing.Size(333, 81);
this.groupBox6.TabIndex = 6;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "Water Meter 6";
//
// wmErrorTextBox6
//
this.wmErrorTextBox6.Location = new System.Drawing.Point(183, 31);
this.wmErrorTextBox6.Font = new System.Drawing.Font("Verdana", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.wmErrorTextBox6.Location = new System.Drawing.Point(183, 21);
this.wmErrorTextBox6.Name = "wmErrorTextBox6";
this.wmErrorTextBox6.Size = new System.Drawing.Size(163, 31);
this.wmErrorTextBox6.Size = new System.Drawing.Size(137, 52);
this.wmErrorTextBox6.TabIndex = 1;
//
// wmErrorLabel6
@@ -246,7 +252,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGoldenrod;
this.ClientSize = new System.Drawing.Size(559, 565);
this.ClientSize = new System.Drawing.Size(868, 565);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox4);
@@ -260,6 +266,7 @@
this.Text = "Water Meter States";
this.TopMost = true;
this.Load += new System.EventHandler(this.CycleEndForm_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.WMErrorsForm_Paint);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);