Code:

Public Class Form1
    Private g As Graphics
    'Private xPosition As Integer
    Private yposition As Integer
   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Height = 550
        Me.Width = 800
        Me.Show()
        g = Me.CreateGraphics
        Me.BackColor = Color.Aquamarine
        Timer3.Start()
    End Sub
  Private Sub DrawNewRectangle1(ByVal y As Integer, ByVal x As Integer)   REM DOOR OPENING RECTANGLE
        Me.Refresh()
        g.DrawRectangle(Pens.Black, 130, 50, 543, 400)
        g.FillRectangle(Brushes.Orchid, 130, 50, y, 400)
        g.FillEllipse(Brushes.Green, 7, 184, 30, 30)
        g.DrawRectangle(Pens.Black, 120, 50, 10, 30)
        'g.DrawRectangle(Pens.Black, 120, 420, 10, 30)
     g.DrawRectangle(Pens.Black, 673, 50, 10, 30)    REM  LS2
     If y <= 7 Then
          ' g.FillRectangle(Brushes.Green, 530, 50, 10, 30)
          g.FillRectangle(Brushes.Green, 120, 50, 10, 30)     'LS1
            g.FillEllipse(Brushes.Black, 7, 184, 30, 30)
            Button1.ForeColor = Color.Black
            REM  Timer1.Stop()
        End If
    End Sub
    Private Sub DrawNewRectangle2(ByVal y As Integer, ByVal x As Integer)   REM DOOR CLOSING RECTANGLE
        'g.DrawRectangle(Pens.Black, 130, 50, 400, 400)
        g.FillRectangle(Brushes.Orchid, 130, 50, y, 400)   REM  DOOR CLOSE FILL RECTANGLE
        'g.DrawRectangle(Pens.Black, 120, 420, 10, 30) REM(X,Y,W,H)
        'g.DrawRectangle(Pens.Black, 120, 50, 10, 30)
        If y >= 400 Then
            Button3.ForeColor = Color.Black
        End If
    End Sub
   'Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
   'End Sub
   Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick     REM DOOR OPENING TIMER
        If yposition < 7 Then
            REM  xPosition = 7

            'If CheckBox1.Checked = True Then
            'My.Computer.Audio.Play(My.Resources.b, AudioPlayMode.Background)
            '
            ' g.FillRectangle(Brushes.Green, 530, 50, 10, 30)
            'g.FillRectangle(Brushes.Green, 120, 50, 10, 30)
            Timer1.Stop()
            Button3.Enabled = True
            Button1.Enabled = False
            'End If
        End If
        yposition -= 15.5
        DrawNewRectangle1(yposition, 400)       REM DOOR OPENING RECTANGLE

    End Sub
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick       REM DOOR CLOSING TIMER
        If yposition > 512 Then
            REM YPosition = 400  355   ===370
            'My.Computer.Audio.Play(My.Resources.b, AudioPlayMode.Background)
            g.FillEllipse(Brushes.Black, 7, 184, 30, 30)        REM RGB BLACK
           g.FillRectangle(Brushes.Green, 673, 50, 10, 30)    REM LIMIT SWITCH 2 GREEEN
         ' g.FillRectangle(Brushes.Green, 120, 420, 10, 30)    REM LIMIT SWITCH 2 GREEEN
            Timer2.Stop()
            Button1.Enabled = True
            Button3.Enabled = False
        End If
        yposition += 15.5                                   REM   30.6    15.5
        DrawNewRectangle2(yposition, 400)
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Start()
        Timer2.Stop()
        'g.FillEllipse(Brushes.Green, 7, 184, 30, 30)
        Button1.ForeColor = Color.Green
        REM Button1.BackColor = Color.Violet
        'My.Computer.Audio.Play(My.Resources.a, AudioPlayMode.Background)
        Button3.Enabled = False
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer2.Stop()
        Timer1.Stop()
        'g.FillEllipse(Brushes.Black, 7, 184, 30, 30)
        Button1.ForeColor = Color.Black
        Button3.ForeColor = Color.Black
        'My.Computer.Audio.Play(My.Resources.b, AudioPlayMode.Background)
        Button1.Enabled = True
        Button3.Enabled = True
      If yposition <= 7 Then
            Button1.Enabled = False
        End If
        If yposition >= 512 Then
            Button3.Enabled = False
        End If
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Timer2.Start()
        Timer1.Stop()
        Me.Refresh()
        g.FillEllipse(Brushes.Red, 7, 184, 30, 30)    REM  RGB   Red
        Button3.ForeColor = Color.Red
        'My.Computer.Audio.Play(My.Resources.a, AudioPlayMode.Background)
        Button1.Enabled = False
    End Sub
    'Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    '    'Me.Hide()
    '    'Form3.Show()
    'End Sub
    Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
        g.DrawRectangle(Pens.Black, 120, 50, 10, 30)    REM limit switch 1
        ' g.DrawRectangle(Pens.Black, 120, 420, 10, 30)    REM limit switch 2
        g.DrawRectangle(Pens.Black, 673, 50, 10, 30)    REM limit switch 2

        g.DrawRectangle(Pens.Black, 130, 50, 543, 400)    REM door rec
        g.DrawEllipse(Pens.Black, 7, 184, 30, 30)        REM rgb
        Button1.BackColor = Color.BlueViolet
        Button2.BackColor = Color.BlueViolet
        Button3.BackColor = Color.BlueViolet
        'Button4.BackColor = Color.BlueViolet
    End Sub
End Class
Next
This is the most recent post.
Previous
Older Post

Post a Comment

Auto Gate HMI Animation VB.NET | Automatic Gate Open Close Application S...

Code: Public Class Form1     Private g As Graphics     'Private xPosition As Integer     Private yposition As Integer    Private Sub For...

 
Top