none
Rotando imagenes RRS feed

  • Pregunta

  • Hola: un saludo, muy buenas  verán tengo un codigo que primero me hace un Random para mezclar imagen o picturebox , y al final del next, declaro un timer con un intervalo de 100 para colocar las picturebox en la posición que yo quiero, hasta hay todo bien; pero cuando hago click en una picturebox quiero volver a rotarla y desplazarla a otra posición, la posición deseada es correcta, pero la rotación no me la hace ¿por que no me sale rotada?. que estoy haciendo mal. gracias.     saludo de nuevo
    
    jueves, 7 de mayo de 2015 7:32

Todas las respuestas

  • La verdad, no sé como vamos a poder ayudarte sin ver el código.

    jueves, 7 de mayo de 2015 8:55
  •   Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            'REPARTIR FICHAS
            Dim listaimagenes As New List(Of Image)
            For index = 1 To 28
                Dim picture As PictureBox = Me.Controls.Item("PictureBox" + index.ToString())
                listaimagenes.Add(picture.Image)
            Next
            Dim rnd As New Random(DateTime.Now.Millisecond)
            For inde = 1 To 28
                Dim pos As Integer = rnd.Next(listaimagenes.Count)
                Dim picture As PictureBox = Me.Controls.Item("PictureBox" + inde.ToString())
                picture.Image = listaimagenes(pos)
                Timer1.Start()
                listaimagenes.RemoveAt(pos)
            Next
    
      Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            If counter >= 28 Then
                ' Exit loop code.
                Timer1.Enabled = False
                counter = 0
            Else
                ' Run your procedure here.
                ' Increment counter.
                counter = counter + 1
                '1º tadar de 7 fichas arriba`
                If counter = 1 Then
                    PictureBox35.Visible = False
                    PictureBox15.Location = New Point(329, 35)
                End If
                If counter = 2 Then
                    PictureBox34.Visible = False
                    PictureBox16.Location = New Point(382, 35)
                End If
                If counter = 3 Then
                    PictureBox33.Visible = False
                    PictureBox18.Location = New Point(436, 35)
                End If
                If counter = 4 Then
                    PictureBox32.Visible = False
                    PictureBox27.Location = New Point(489, 35)
                End If
                If counter = 5 Then
                    PictureBox31.Visible = False
                    PictureBox17.Location = New Point(540, 35)
                End If
                If counter = 6 Then
                    PictureBox30.Visible = False
                    PictureBox26.Location = New Point(593, 35)
                End If
                If counter = 7 Then
                    PictureBox29.Visible = False
                    PictureBox25.Location = New Point(644, 35)
                End If
    
                '1º tanda de 7 fichas abajo`
                If counter = 8 Then
                    PictureBox56.Visible = False
                    PictureBox24.Location = New Point(335, 500)
                End If
                If counter = 9 Then
                    PictureBox55.Visible = False
                    PictureBox22.Location = New Point(389, 500)
                End If
                If counter = 10 Then
                    PictureBox54.Visible = False
                    PictureBox10.Location = New Point(443, 500)
                End If
                If counter = 11 Then
                    PictureBox53.Visible = False
                    PictureBox19.Location = New Point(495, 500)
                End If
                If counter = 12 Then
                    PictureBox52.Visible = False
                    PictureBox28.Location = New Point(548, 500)
                End If
                If counter = 13 Then
                    PictureBox51.Visible = False
                    PictureBox21.Location = New Point(599, 500)
                End If
                If counter = 14 Then
                    PictureBox50.Visible = False
                    PictureBox23.Location = New Point(652, 500)
                End If
    
                '3º tanda fichas lado izquierdo
                If counter = 15 Then
                    PictureBox42.Visible = False
                    PictureBox14.Location = New Point(135, 122)
                    PictureBox14.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox14.Width = 69
                    PictureBox14.Height = 50
                End If
                If counter = 16 Then
                    PictureBox41.Visible = False
                    PictureBox1.Location = New Point(135, 173)
                    PictureBox1.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox1.Width = 69
                    PictureBox1.Height = 50
                End If
                If counter = 17 Then
                    PictureBox40.Visible = False
                    PictureBox2.Location = New Point(135, 225)
                    PictureBox2.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox2.Width = 69
                    PictureBox2.Height = 50
                End If
                If counter = 18 Then
                    PictureBox39.Visible = False
                    PictureBox5.Location = New Point(135, 277)
                    PictureBox5.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox5.Width = 69
                    PictureBox5.Height = 50
                End If
                If counter = 19 Then
                    PictureBox38.Visible = False
                    PictureBox7.Location = New Point(135, 329)
                    PictureBox7.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox7.Width = 69
                    PictureBox7.Height = 50
                End If
                If counter = 20 Then
                    PictureBox37.Visible = False
                    PictureBox12.Location = New Point(135, 382)
                    PictureBox12.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox12.Width = 69
                    PictureBox12.Height = 50
                End If
                If counter = 21 Then
                    PictureBox36.Visible = False
                    Picturebox9.Location = New Point(135, 434)
                    Picturebox9.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    Picturebox9.Width = 69
                    Picturebox9.Height = 50
                End If
    
                '4º tanda de fichas derechas
                If counter = 22 Then
                    PictureBox49.Visible = False
                    PictureBox20.Location = New Point(850, 118)
                    PictureBox20.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox20.Width = 69
                    PictureBox20.Height = 50
                End If
                If counter = 23 Then
                    PictureBox48.Visible = False
                    PictureBox8.Location = New Point(850, 171)
                    PictureBox8.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox8.Width = 69
                    PictureBox8.Height = 50
                End If
                If counter = 24 Then
                    PictureBox47.Visible = False
                    PictureBox3.Location = New Point(850, 223)
                    PictureBox3.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox3.Width = 69
                    PictureBox3.Height = 50
                End If
                If counter = 25 Then
                    PictureBox46.Visible = False
                    PictureBox6.Location = New Point(850, 276)
                    PictureBox6.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox6.Width = 69
                    PictureBox6.Height = 50
                End If
                If counter = 26 Then
                    PictureBox45.Visible = False
                    PictureBox4.Location = New Point(850, 329)
                    PictureBox4.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox4.Width = 69
                    PictureBox4.Height = 50
                End If
                If counter = 27 Then
                    PictureBox44.Visible = False
                    PictureBox13.Location = New Point(850, 381)
                    PictureBox13.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox13.Width = 69
                    PictureBox13.Height = 50
                End If
                If counter = 28 Then
                    PictureBox43.Visible = False
                    PictureBox11.Location = New Point(850, 435)
                    PictureBox11.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
                    PictureBox11.Width = 69
                    PictureBox11.Height = 50
    
                End If
                Label1.Text = "Ud.fichas: " & counter.ToString
                Button1.Visible = False
                Salir.Location = New Point(838, 30)
            End If
        End Sub
    Hola. buenas hay tienes el codigó gracias Jesú
    jueves, 7 de mayo de 2015 9:38
  • Private Sub PictureBox7_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox7.ClickPictureBox7.Location = New Point (495, 365)PictureBox7.Width = 69PictureBox7.Height = 50Label2.Text = "Ficha nº 7" y sender.tagButton4.Visible = FalseButton3.Visible = TrueButton3.BackColor = Color.CyanMsgBox (PictureBox7.Tag)PictureBox7.Image.RotateFlip (RotateFlipType.Rotate180FlipNone)End Sub
    Hola: de nuevo, se me olvido  mandar el click de unas de las picturexbox
    jueves, 7 de mayo de 2015 9:54