AdvancedHMI Software
General Category => Feature Request => Topic started by: MrPike on October 14, 2016, 02:45:51 PM
-
Hi Archie. I was just at a site that had a screen clean feature that freezes all controls while the screen is being wiped down. I suppose this can be accomplished by just creating a separate form that automatically times out after a minute or two. It may have additional features to ensure nothing is pushed by accident. Maybe a nice feature to add to AHMI.
-
Here is a quick way to implement that feature with a few lines of code:
1) From the Toolbox's All Windows Forms group, add a Button to the form
2) Set the Text property to Clean Screen
3) Double click the button to get back to the code
4) Enter this code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim f As New Form
f.FormBorderStyle = Windows.Forms.FormBorderStyle.None
f.WindowState = FormWindowState.Maximized
f.Show()
System.Threading.Thread.Sleep(10000)
f.Close()
End Sub
-
Very nice. Here is an image to add to the form. Courtesy of the system I just worked on.
-
Also does the System.Threading.Thread.Sleep method have a value property to view the elapsed time? I didn't see anything on MSDN
-
Showing an elapsed/count down gets a bit more complicated to do. But this is how to do it:
Private f As Form
Private WithEvents t As New System.Windows.Forms.Timer
Private TickCount As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
f = New Form
f.FormBorderStyle = Windows.Forms.FormBorderStyle.None
f.WindowState = FormWindowState.Maximized
Dim l As New Label
l.Size = f.Size
l.Font = New Font("Arial", 48)
l.Text = "Starting"
l.Location = New Point(0, 0)
l.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
l.Dock = DockStyle.Fill
f.Controls.Add(l)
f.Show()
TickCount = 0
t.Interval = 1000
t.Enabled = True
End Sub
Private Sub TickEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles t.Tick
If f IsNot Nothing AndAlso Not f.IsDisposed Then
Dim l As Label = f.Controls(0)
l.Text = 10 - TickCount
TickCount += 1
If TickCount >= 10 Then
t.Enabled = False
f.Close()
End If
End If
End Sub
-
That's very cool! Its been a while, since I last saw a clean screen from panelviewplus FTV.
p