Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.90 KB | None | 0 0
  1. Public Class spelen_met_controls
  2.  
  3.     Private links, rechts As Boolean
  4.     Private x, y As New Random
  5.  
  6.     Private Sub spelen_met_controls_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.         Me.Width = 500
  8.         Me.Height = 500
  9.         rechts = True
  10.  
  11.     End Sub
  12.  
  13.     Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick
  14.         Application.DoEvents()
  15.  
  16.         'button bewegen
  17.         Btn_bewegen.Location = New System.Drawing.Point(x.Next(1, Me.Width - 150), y.Next(1, Me.Height - 150))
  18.  
  19.         'scrolling marquee, maar binnen de grenzen van het scherm
  20.         If (rechts) Then
  21.             Lbl_marquee.Location = New System.Drawing.Point(Lbl_marquee.Location.X + 10, 20)
  22.             If (Lbl_marquee.Location.X > Me.Width - 150) Then
  23.                 rechts = False
  24.                 links = True
  25.             End If
  26.         Else
  27.             Lbl_marquee.Location = New System.Drawing.Point(Lbl_marquee.Location.X - 10, 20)
  28.             If (Lbl_marquee.Location.X < 50) Then
  29.                 rechts = True
  30.                 links = False
  31.             End If
  32.         End If
  33.  
  34.         'verspringende kleur van de 'marquee'
  35.         If (Lbl_marquee.ForeColor.ToString = System.Drawing.Color.Red.ToString) Then
  36.             Lbl_marquee.ForeColor() = System.Drawing.Color.Blue
  37.         Else
  38.             Lbl_marquee.ForeColor() = System.Drawing.Color.Red
  39.         End If
  40.  
  41.     End Sub
  42.  
  43.     Private Sub Btn_start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_start.Click
  44.  
  45.         If (Timer.Enabled = True) Then
  46.             Timer.Enabled = False
  47.         Else
  48.             Timer.Enabled = True
  49.         End If
  50.     End Sub
  51.  
  52.     Private Sub Btn_bewegen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_bewegen.Click
  53.         Timer.Enabled = False
  54.     End Sub
  55. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement