Width of the form with "Test bench framework program is closing" is calculated from the text width.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TBF.Resources;
|
||||
|
||||
@@ -17,21 +18,25 @@ namespace TBF.Forms
|
||||
|
||||
label1.Text = Strings.Closing_Test_Bench_Framework;
|
||||
|
||||
timer = new Timer();
|
||||
timer.Interval = 1000;
|
||||
timer.Tick += new EventHandler(timer_Tick);
|
||||
timer.Start();
|
||||
}
|
||||
float textWidth = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(label1.Text, label1.Font).Width;
|
||||
|
||||
void timer_Tick(object sender, EventArgs args)
|
||||
{
|
||||
if (!TBF.BenchControl.StateMachine.Running)
|
||||
{
|
||||
timer.Stop();
|
||||
timer.Dispose();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Width = (int)textWidth + 120; /// Form width calculated from the text width
|
||||
|
||||
timer = new Timer();
|
||||
timer.Interval = 1000;
|
||||
timer.Tick += new EventHandler(timer_Tick);
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
void timer_Tick(object sender, EventArgs args)
|
||||
{
|
||||
if (!TBF.BenchControl.StateMachine.Running)
|
||||
{
|
||||
timer.Stop();
|
||||
timer.Dispose();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user