Advertisement
TermSpar

Picturebox Arrays (by Ben Bollinger)

Jan 8th, 2016
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.14 KB | None | 0 0
  1. Public Class Form1
  2.     Dim picLoc() As PictureBox
  3.     Dim anyImage1() As PictureBox
  4.     Dim anyImage2() As PictureBox
  5.     Dim anyImage3() As PictureBox
  6.  
  7.     Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
  8.         PictureBox1.Hide()
  9.         PictureBox2.Hide()
  10.         PictureBox3.Hide()
  11.         anyImage1 = {Me.PictureBox2, Me.PictureBox3}
  12.         anyImage2 = {Me.PictureBox1, Me.PictureBox3}
  13.         anyImage3 = {Me.PictureBox2, Me.PictureBox1}
  14.     End Sub
  15.  
  16.     Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  17.         PictureBox1.Show()
  18.         picLoc = {Me.PictureBox1}
  19.         For Each p As PictureBox In anyImage1
  20.             If PictureBox3.Visible = True Or PictureBox2.Visible = True Then
  21.                 PictureBox1.Location = New Point(12, 427)
  22.                 p.Left += 90
  23.             End If
  24.         Next
  25.     End Sub
  26.  
  27.     Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
  28.         PictureBox2.Show()
  29.         picLoc = {Me.PictureBox2}
  30.         For Each p As PictureBox In anyImage2
  31.             If PictureBox1.Visible = True Or PictureBox3.Visible = True Then
  32.                 PictureBox2.Location = New Point(12, 427)
  33.                 p.Left += 90
  34.             End If
  35.         Next
  36.     End Sub
  37.  
  38.     Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
  39.         PictureBox3.Show()
  40.         picLoc = {Me.PictureBox3}
  41.         For Each p As PictureBox In anyImage3
  42.             If PictureBox1.Visible = True Or PictureBox2.Visible = True Then
  43.                 PictureBox3.Location = New Point(12, 427)
  44.                 p.Left += 90
  45.             End If
  46.         Next
  47.     End Sub
  48.  
  49.     Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
  50.         If PictureBox1.Visible = True Then
  51.             PictureBox1.Hide()
  52.             For Each p In anyImage1
  53.                 If p.Location.X > 102 Then
  54.                     p.Left -= 90
  55.                 ElseIf PictureBox1.Location = New Point(12, 427) Then
  56.                     p.Left -= 90
  57.                 End If
  58.             Next
  59.         End If
  60.     End Sub
  61.  
  62.     Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
  63.         If PictureBox2.Visible = True Then
  64.             PictureBox2.Hide()
  65.             For Each p In anyImage2
  66.                 If p.Location.X > 102 Then
  67.                     p.Left -= 90
  68.                 ElseIf PictureBox2.Location = New Point(12, 427) Then
  69.                     p.Left -= 90
  70.                 End If
  71.             Next
  72.         End If
  73.     End Sub
  74.  
  75.     Private Sub Button6_Click(sender As System.Object, e As System.EventArgs) Handles Button6.Click
  76.         If PictureBox3.Visible = True Then
  77.             PictureBox3.Hide()
  78.             For Each p In anyImage3
  79.                 If p.Location.X > 102 Then
  80.                     p.Left -= 90
  81.                 ElseIf PictureBox3.Location = New Point(12, 427) Then
  82.                     p.Left -= 90
  83.                 End If
  84.             Next
  85.         End If
  86.     End Sub
  87. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement