Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form5
- Dim Rnd As New Random
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Timer1.Enabled = Not Timer1.Enabled
- End Sub
- Dim la(16) As Label
- Private Sub Form5_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- For i = 0 To 15
- la(i) = New Label
- la(i).Width = 20
- la(i).Height = 20
- la(i).AutoSize = False
- la(i).Text = ""
- la(i).BorderStyle = BorderStyle.FixedSingle
- la(i).BackColor = Color.Black
- la(i).Left = 20 + 25 * i
- la(i).Top = 188
- la(i).Parent = Me
- Next
- End Sub
- Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
- Dim a As Int64 = Rnd.Next(2 ^ 16)
- Dim b As Int64
- Dim c As String
- While a <> 0
- b = a Mod 2
- a = a \ 2
- c = b & c
- End While
- Label1.Text = StrDup(16 - Len(c), "0") & c
- For i = 0 To 15
- la(i).BackColor = IIf(Mid(Label1.Text, i + 1, 1) = 1, Color.Green, Color.Black)
- Next
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement