Author Topic: Screen clean  (Read 2138 times)

MrPike

  • Sr. Member
  • ****
  • Posts: 297
    • View Profile
Screen clean
« 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.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5258
    • View Profile
    • AdvancedHMI
Re: Screen clean
« Reply #1 on: October 14, 2016, 03:10:09 PM »
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:
Code: [Select]
    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

MrPike

  • Sr. Member
  • ****
  • Posts: 297
    • View Profile
Re: Screen clean
« Reply #2 on: October 14, 2016, 04:23:43 PM »
Very nice.  Here is an image to add to the form.  Courtesy of the system I just worked on.   

MrPike

  • Sr. Member
  • ****
  • Posts: 297
    • View Profile
Re: Screen clean
« Reply #3 on: October 14, 2016, 04:55:49 PM »
Also does the System.Threading.Thread.Sleep method have a value property to view the elapsed time?  I didn't see anything on MSDN

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5258
    • View Profile
    • AdvancedHMI
Re: Screen clean
« Reply #4 on: October 14, 2016, 05:16:35 PM »
Showing an elapsed/count down gets a bit more complicated to do. But this is how to do it:
Code: [Select]
    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

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Screen clean
« Reply #5 on: October 14, 2016, 10:57:34 PM »
That's very cool! Its been a while, since I last saw a clean screen from panelviewplus FTV.



















p
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================