Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class spelen_met_controls
- Private links, rechts As Boolean
- Private x, y As New Random
- Private Sub spelen_met_controls_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Me.Width = 500
- Me.Height = 500
- rechts = True
- End Sub
- Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick
- Application.DoEvents()
- 'button bewegen
- Btn_bewegen.Location = New System.Drawing.Point(x.Next(1, Me.Width - 150), y.Next(1, Me.Height - 150))
- 'scrolling marquee, maar binnen de grenzen van het scherm
- If (rechts) Then
- Lbl_marquee.Location = New System.Drawing.Point(Lbl_marquee.Location.X + 10, 20)
- If (Lbl_marquee.Location.X > Me.Width - 150) Then
- rechts = False
- links = True
- End If
- Else
- Lbl_marquee.Location = New System.Drawing.Point(Lbl_marquee.Location.X - 10, 20)
- If (Lbl_marquee.Location.X < 50) Then
- rechts = True
- links = False
- End If
- End If
- 'verspringende kleur van de 'marquee'
- If (Lbl_marquee.ForeColor.ToString = System.Drawing.Color.Red.ToString) Then
- Lbl_marquee.ForeColor() = System.Drawing.Color.Blue
- Else
- Lbl_marquee.ForeColor() = System.Drawing.Color.Red
- End If
- End Sub
- Private Sub Btn_start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_start.Click
- If (Timer.Enabled = True) Then
- Timer.Enabled = False
- Else
- Timer.Enabled = True
- End If
- End Sub
- Private Sub Btn_bewegen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_bewegen.Click
- Timer.Enabled = False
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement