Tutoriales gratuitos para el aprendizaje de la programacion informatica! Recuerda que si lo puedes imaginar... lo puedes programar!

Juego del Rompecabezas en VB.NET




CODIFICACIÓN:

Public Class FORM1
    Private Sub BUTTON1_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles Button1.Click
        PICTUREBOX1.IMAGE = IMAGELIST1.IMAGES(6)
        PICTUREBOX2.IMAGE = IMAGELIST1.IMAGES(1)
        PICTUREBOX3.IMAGE = IMAGELIST1.IMAGES(5)
        PICTUREBOX4.IMAGE = IMAGELIST1.IMAGES(2)
        PICTUREBOX6.IMAGE = IMAGELIST1.IMAGES(3)
        PICTUREBOX15.IMAGE = IMAGELIST1.IMAGES(4)
        PICTUREBOX5.IMAGE = IMAGELIST1.IMAGES(7)
        PICTUREBOX7.IMAGE = IMAGELIST1.IMAGES(8)
        PICTUREBOX8.IMAGE = IMAGELIST1.IMAGES(9)
        PICTUREBOX9.IMAGE = IMAGELIST1.IMAGES(10)
        PICTUREBOX10.IMAGE = IMAGELIST1.IMAGES(11)
        PICTUREBOX11.IMAGE = IMAGELIST1.IMAGES(12)
        PICTUREBOX12.IMAGE = IMAGELIST1.IMAGES(13)
        PICTUREBOX13.IMAGE = IMAGELIST1.IMAGES(14)
        PICTUREBOX14.IMAGE = IMAGELIST1.IMAGES(15)
        PICTUREBOX16.IMAGE = IMAGELIST1.IMAGES(0)
        PICTUREBOX1.BACKCOLOR = Color.Gray
        PICTUREBOX2.BACKCOLOR = Color.Gray
        PICTUREBOX3.BACKCOLOR = Color.Gray
        PICTUREBOX4.BACKCOLOR = Color.Gray
        PICTUREBOX6.BACKCOLOR = Color.Gray
        PICTUREBOX15.BACKCOLOR = Color.Gray
        PICTUREBOX5.BACKCOLOR = Color.Gray
        PICTUREBOX7.BACKCOLOR = Color.Gray
        PICTUREBOX8.BACKCOLOR = Color.Gray
        PICTUREBOX9.BACKCOLOR = Color.Gray
        PICTUREBOX10.BACKCOLOR = Color.Gray
        PICTUREBOX11.BACKCOLOR = Color.Gray
        PICTUREBOX12.BACKCOLOR = Color.Gray
        PICTUREBOX13.BACKCOLOR = Color.Gray
        PICTUREBOX14.BACKCOLOR = Color.Gray
        PICTUREBOX15.BACKCOLOR = Color.Gray
        PICTUREBOX16.BACKCOLOR = Color.White
    End Sub
    Private Sub PICTUREBOX15_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX15.CLICK
        If PICTUREBOX16.BACKCOLOR = Color.White Then
            PICTUREBOX16.IMAGE = PICTUREBOX15.IMAGE
            PICTUREBOX16.BACKCOLOR = Color.Gray
            PICTUREBOX15.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX15.BACKCOLOR = Color.White
        End If
        If PICTUREBOX14.BACKCOLOR = Color.White Then
            PICTUREBOX14.IMAGE = PICTUREBOX15.IMAGE
            PICTUREBOX14.BACKCOLOR = Color.Gray
            PICTUREBOX15.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX15.BACKCOLOR = Color.White
        End If
        If PICTUREBOX11.BACKCOLOR = Color.White Then
            PICTUREBOX11.IMAGE = PICTUREBOX15.IMAGE
            PICTUREBOX11.BACKCOLOR = Color.Gray
            PICTUREBOX15.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX15.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX16_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX16.CLICK
        If PICTUREBOX12.BACKCOLOR = Color.White Then
            PICTUREBOX12.IMAGE = PICTUREBOX16.IMAGE
            PICTUREBOX12.BACKCOLOR = Color.Gray
            PICTUREBOX16.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX16.BACKCOLOR = Color.White
        End If
        If PICTUREBOX15.BACKCOLOR = Color.White Then
            PICTUREBOX15.IMAGE = PICTUREBOX16.IMAGE
            PICTUREBOX15.BACKCOLOR = Color.Gray
            PICTUREBOX16.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX16.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX14_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX14.CLICK
        If PICTUREBOX13.BACKCOLOR = Color.White Then
            PICTUREBOX13.IMAGE = PICTUREBOX14.IMAGE
            PICTUREBOX13.BACKCOLOR = Color.Gray
            PICTUREBOX14.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX14.BACKCOLOR = Color.White
        End If
        If PICTUREBOX10.BACKCOLOR = Color.White Then
            PICTUREBOX10.IMAGE = PICTUREBOX14.IMAGE
            PICTUREBOX10.BACKCOLOR = Color.Gray
            PICTUREBOX14.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX14.BACKCOLOR = Color.White
        End If
        If PICTUREBOX15.BACKCOLOR = Color.White Then
            PICTUREBOX15.IMAGE = PICTUREBOX14.IMAGE
            PICTUREBOX15.BACKCOLOR = Color.Gray
            PICTUREBOX14.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX14.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX13_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX13.CLICK
        If PICTUREBOX9.BACKCOLOR = Color.White Then
            PICTUREBOX9.IMAGE = PICTUREBOX13.IMAGE
            PICTUREBOX9.BACKCOLOR = Color.Gray
            PICTUREBOX13.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX13.BACKCOLOR = Color.White
        End If
        If PICTUREBOX14.BACKCOLOR = Color.White Then
            PICTUREBOX14.IMAGE = PICTUREBOX13.IMAGE
            PICTUREBOX14.BACKCOLOR = Color.Gray
            PICTUREBOX13.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX13.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX9_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX9.CLICK
        If PICTUREBOX5.BACKCOLOR = Color.White Then
            PICTUREBOX5.IMAGE = PICTUREBOX9.IMAGE
            PICTUREBOX5.BACKCOLOR = Color.Gray
            PICTUREBOX9.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX9.BACKCOLOR = Color.White
        End If
        If PICTUREBOX10.BACKCOLOR = Color.White Then
            PICTUREBOX10.IMAGE = PICTUREBOX9.IMAGE
            PICTUREBOX10.BACKCOLOR = Color.Gray
            PICTUREBOX9.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX9.BACKCOLOR = Color.White
        End If
        If PICTUREBOX13.BACKCOLOR = Color.White Then
            PICTUREBOX13.IMAGE = PICTUREBOX9.IMAGE
            PICTUREBOX13.BACKCOLOR = Color.Gray
            PICTUREBOX9.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX9.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX10_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX10.CLICK
        If PICTUREBOX6.BACKCOLOR = Color.White Then
            PICTUREBOX6.IMAGE = PICTUREBOX10.IMAGE
            PICTUREBOX6.BACKCOLOR = Color.Gray
            PICTUREBOX10.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX10.BACKCOLOR = Color.White
        End If
        If PICTUREBOX9.BACKCOLOR = Color.White Then
            PICTUREBOX9.IMAGE = PICTUREBOX10.IMAGE
            PICTUREBOX9.BACKCOLOR = Color.Gray
            PICTUREBOX10.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX10.BACKCOLOR = Color.White
        End If
        If PICTUREBOX14.BACKCOLOR = Color.White Then
            PICTUREBOX14.IMAGE = PICTUREBOX10.IMAGE
            PICTUREBOX14.BACKCOLOR = Color.Gray
            PICTUREBOX10.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX10.BACKCOLOR = Color.White
        End If
        If PICTUREBOX11.BACKCOLOR = Color.White Then
            PICTUREBOX11.IMAGE = PICTUREBOX10.IMAGE
            PICTUREBOX11.BACKCOLOR = Color.Gray
            PICTUREBOX10.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX10.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX11_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX11.CLICK
        If PICTUREBOX7.BACKCOLOR = Color.White Then
            PICTUREBOX7.IMAGE = PICTUREBOX11.IMAGE
            PICTUREBOX7.BACKCOLOR = Color.Gray
            PICTUREBOX11.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX11.BACKCOLOR = Color.White
        End If
        If PICTUREBOX10.BACKCOLOR = Color.White Then
            PICTUREBOX10.IMAGE = PICTUREBOX11.IMAGE
            PICTUREBOX10.BACKCOLOR = Color.Gray
            PICTUREBOX11.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX11.BACKCOLOR = Color.White
        End If
        If PICTUREBOX15.BACKCOLOR = Color.White Then
            PICTUREBOX15.IMAGE = PICTUREBOX11.IMAGE
            PICTUREBOX15.BACKCOLOR = Color.Gray
            PICTUREBOX11.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX11.BACKCOLOR = Color.White
        End If
        If PICTUREBOX12.BACKCOLOR = Color.White Then
            PICTUREBOX12.IMAGE = PICTUREBOX11.IMAGE
            PICTUREBOX12.BACKCOLOR = Color.Gray
            PICTUREBOX11.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX11.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX12_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX12.CLICK
        If PICTUREBOX8.BACKCOLOR = Color.White Then
            PICTUREBOX8.IMAGE = PICTUREBOX12.IMAGE
            PICTUREBOX8.BACKCOLOR = Color.Gray
            PICTUREBOX12.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX12.BACKCOLOR = Color.White
        End If
        If PICTUREBOX16.BACKCOLOR = Color.White Then
            PICTUREBOX16.IMAGE = PICTUREBOX12.IMAGE
            PICTUREBOX16.BACKCOLOR = Color.Gray
            PICTUREBOX12.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX12.BACKCOLOR = Color.White
        End If
        If PICTUREBOX11.BACKCOLOR = Color.White Then
            PICTUREBOX11.IMAGE = PICTUREBOX12.IMAGE
            PICTUREBOX11.BACKCOLOR = Color.Gray
            PICTUREBOX12.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX12.BACKCOLOR = Color.White
        End If

    End Sub
Private Sub PICTUREBOX8_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX8.CLICK
        If PICTUREBOX4.BACKCOLOR = Color.White Then
            PICTUREBOX4.IMAGE = PICTUREBOX8.IMAGE
            PICTUREBOX4.BACKCOLOR = Color.Gray
            PICTUREBOX8.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX8.BACKCOLOR = Color.White
        End If
        If PICTUREBOX7.BACKCOLOR = Color.White Then
            PICTUREBOX7.IMAGE = PICTUREBOX8.IMAGE
            PICTUREBOX7.BACKCOLOR = Color.Gray
            PICTUREBOX8.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX8.BACKCOLOR = Color.White
        End If
        If PICTUREBOX12.BACKCOLOR = Color.White Then
            PICTUREBOX12.IMAGE = PICTUREBOX8.IMAGE
            PICTUREBOX12.BACKCOLOR = Color.Gray
            PICTUREBOX8.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX8.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX7_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX7.CLICK
        If PICTUREBOX3.BACKCOLOR = Color.White Then
            PICTUREBOX3.IMAGE = PICTUREBOX7.IMAGE
            PICTUREBOX3.BACKCOLOR = Color.Gray
            PICTUREBOX7.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX7.BACKCOLOR = Color.White
        End If
        If PICTUREBOX8.BACKCOLOR = Color.White Then
            PICTUREBOX8.IMAGE = PICTUREBOX7.IMAGE
            PICTUREBOX8.BACKCOLOR = Color.Gray
            PICTUREBOX7.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX7.BACKCOLOR = Color.White
        End If
        If PICTUREBOX6.BACKCOLOR = Color.White Then
            PICTUREBOX6.IMAGE = PICTUREBOX7.IMAGE
            PICTUREBOX6.BACKCOLOR = Color.Gray
            PICTUREBOX7.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX7.BACKCOLOR = Color.White
        End If
        If PICTUREBOX11.BACKCOLOR = Color.White Then
            PICTUREBOX11.IMAGE = PICTUREBOX7.IMAGE
            PICTUREBOX11.BACKCOLOR = Color.Gray
            PICTUREBOX7.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX7.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX6_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX6.CLICK
        If PICTUREBOX2.BACKCOLOR = Color.White Then
            PICTUREBOX2.IMAGE = PICTUREBOX6.IMAGE
            PICTUREBOX2.BACKCOLOR = Color.Gray
            PICTUREBOX6.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX6.BACKCOLOR = Color.White
        End If
        If PICTUREBOX5.BACKCOLOR = Color.White Then
            PICTUREBOX5.IMAGE = PICTUREBOX6.IMAGE
            PICTUREBOX5.BACKCOLOR = Color.Gray
            PICTUREBOX6.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX6.BACKCOLOR = Color.White
        End If
        If PICTUREBOX7.BACKCOLOR = Color.White Then
            PICTUREBOX7.IMAGE = PICTUREBOX6.IMAGE
            PICTUREBOX7.BACKCOLOR = Color.Gray
            PICTUREBOX6.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX6.BACKCOLOR = Color.White
        End If
        If PICTUREBOX10.BACKCOLOR = Color.White Then
            PICTUREBOX10.IMAGE = PICTUREBOX6.IMAGE
            PICTUREBOX10.BACKCOLOR = Color.Gray
            PICTUREBOX6.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX6.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX5_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX5.CLICK
        If PICTUREBOX1.BACKCOLOR = Color.White Then
            PICTUREBOX1.IMAGE = PICTUREBOX5.IMAGE
            PICTUREBOX1.BACKCOLOR = Color.Gray
            PICTUREBOX5.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX5.BACKCOLOR = Color.White
        End If
        If PICTUREBOX6.BACKCOLOR = Color.White Then
            PICTUREBOX6.IMAGE = PICTUREBOX5.IMAGE
            PICTUREBOX6.BACKCOLOR = Color.Gray
            PICTUREBOX5.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX5.BACKCOLOR = Color.White
        End If
        If PICTUREBOX9.BACKCOLOR = Color.White Then
            PICTUREBOX9.IMAGE = PICTUREBOX5.IMAGE
            PICTUREBOX9.BACKCOLOR = Color.Gray
            PICTUREBOX5.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX5.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX1_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX1.CLICK
        If PICTUREBOX2.BACKCOLOR = Color.White Then
            PICTUREBOX2.IMAGE = PICTUREBOX1.IMAGE
            PICTUREBOX2.BACKCOLOR = Color.Gray
            PICTUREBOX1.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX1.BACKCOLOR = Color.White
        End If
        If PICTUREBOX5.BACKCOLOR = Color.White Then
            PICTUREBOX5.IMAGE = PICTUREBOX1.IMAGE
            PICTUREBOX5.BACKCOLOR = Color.Gray
            PICTUREBOX1.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX1.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX2_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX2.CLICK
        If PICTUREBOX1.BACKCOLOR = Color.White Then
            PICTUREBOX1.IMAGE = PICTUREBOX2.IMAGE
            PICTUREBOX1.BACKCOLOR = Color.Gray
            PICTUREBOX2.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX2.BACKCOLOR = Color.White
        End If
        If PICTUREBOX3.BACKCOLOR = Color.White Then
            PICTUREBOX3.IMAGE = PICTUREBOX2.IMAGE
            PICTUREBOX3.BACKCOLOR = Color.Gray
            PICTUREBOX2.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX2.BACKCOLOR = Color.White
        End If
        If PICTUREBOX6.BACKCOLOR = Color.White Then
            PICTUREBOX6.IMAGE = PICTUREBOX2.IMAGE
            PICTUREBOX6.BACKCOLOR = Color.Gray
            PICTUREBOX2.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX2.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX3_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX3.CLICK
        If PICTUREBOX2.BACKCOLOR = Color.White Then
            PICTUREBOX2.IMAGE = PICTUREBOX3.IMAGE
            PICTUREBOX2.BACKCOLOR = Color.Gray
            PICTUREBOX3.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX3.BACKCOLOR = Color.White
        End If
        If PICTUREBOX4.BACKCOLOR = Color.White Then
            PICTUREBOX4.IMAGE = PICTUREBOX3.IMAGE
            PICTUREBOX4.BACKCOLOR = Color.Gray
            PICTUREBOX3.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX3.BACKCOLOR = Color.White
        End If
        If PICTUREBOX7.BACKCOLOR = Color.White Then
            PICTUREBOX7.IMAGE = PICTUREBOX3.IMAGE
            PICTUREBOX7.BACKCOLOR = Color.Gray
            PICTUREBOX3.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX3.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub PICTUREBOX4_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles PICTUREBOX4.CLICK
        If PICTUREBOX3.BACKCOLOR = Color.White Then
            PICTUREBOX3.IMAGE = PICTUREBOX4.IMAGE
            PICTUREBOX3.BACKCOLOR = Color.Gray
            PICTUREBOX4.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX4.BACKCOLOR = Color.White
        End If
        If PICTUREBOX8.BACKCOLOR = Color.White Then
            PICTUREBOX8.IMAGE = PICTUREBOX4.IMAGE
            PICTUREBOX8.BACKCOLOR = Color.Gray
            PICTUREBOX4.IMAGE = IMAGELIST1.IMAGES(0)
            PICTUREBOX4.BACKCOLOR = Color.White
        End If
    End Sub
    Private Sub BUTTON2_CLICK(ByVal SENDER As System.Object, ByVal E As System.EventArgs) Handles BUTTON2.CLICK
        FORM2.SHOW()
    End Sub
End Class

1 comentario:

  1. Buen contenido te felicito.. me sirvio mucho me despejo muchas dudas

    ResponderEliminar