Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Public terminators(6) As PictureBox
- Public terminatorList As New List(Of PictureBox)
- Private Sub lblHide_Click(sender As Object, e As EventArgs) Handles lblHide.Click
- Dim x As Integer
- 'For x = 0 To terminators.Length - 1
- ' terminators(x).Visible = False
- 'Next
- Dim p As PictureBox
- For Each p In terminatorList
- p.Visible = False
- Next
- lblShow.Visible = True
- lblHide.Visible = False
- End Sub
- Private Sub lblShow_Click(sender As Object, e As EventArgs) Handles lblShow.Click
- Dim x As Integer
- For x = 0 To terminators.Length - 1
- terminators(x).Visible = True
- Next
- Dim p As PictureBox
- For Each p In terminatorList
- p.Visible = True
- Next
- 'when you click show, you need to enable the hide feature
- lblHide.Visible = True
- lblShow.Visible = False
- End Sub
- Private Sub PictureBoxALL_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click, PictureBox2.Click, PictureBox3.Click, PictureBox4.Click, PictureBox5.Click, PictureBox6.Click, PictureBox7.Click
- Dim p As PictureBox
- p = DirectCast(sender, PictureBox)
- p.Visible = False
- 'check if all are now hidden
- 'if so, disable the Hide command
- Dim allHidden As Boolean
- allHidden = True
- For Each p In terminatorList
- If p.Visible = True Then
- allHidden = False
- End If
- Next
- If allHidden = True Then
- lblHide.Visible = False
- lblShow.Visible = True
- End If
- lblShow.Visible = True
- End Sub
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- 'load array
- terminators = {PictureBox1, PictureBox2, PictureBox3, PictureBox4, PictureBox5, PictureBox6, PictureBox7}
- 'load list
- terminatorList.Add(PictureBox1)
- terminatorList.Add(PictureBox2)
- terminatorList.Add(PictureBox3)
- terminatorList.Add(PictureBox4)
- terminatorList.Add(PictureBox5)
- terminatorList.Add(PictureBox6)
- terminatorList.Add(PictureBox7)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement