none
Mover pictureBox circularmente (dentro de una elipse) RRS feed

  • Question

  • Hola a todos.

    Tengo un proyecto de crear un sistema solar con pictureBox. ¿Como hago para que 2 pictureBox se muevan en circulos, imitando a los planetas, por toda la form?

    Muchas gracias, Saludos!

    Monday, March 11, 2013 10:47 PM

Answers

  • ¡Hola Adolforp94!

    Por favor,intente lo siguiente:

        Dim degrees As Integer = 0
        Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
            degrees += 1
            If degrees >= 360 Then degrees = 0
            Dim a As Double = degrees * Math.PI / 180
            Dim x As Integer = 100 * Math.Cos(a) + 250
            Dim y As Integer = 100 * Math.Sin(a) + 250
            PictureBox1.Left = y
            PictureBox1.Top = x
        End Sub


    Chuck


    Chuck

    Wednesday, March 13, 2013 4:59 PM

All replies

  • Hi
    Welcome to the MSDN forum.

    Please use English here to post your doubt, not Spanish. I will move this thread to off-topic.

    Thanks for your understanding,
    Regards,


    Elegentin Xie
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, March 13, 2013 3:03 AM
  • ¡Hola Adolforp94!

    Por favor,intente lo siguiente:

        Dim degrees As Integer = 0
        Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
            degrees += 1
            If degrees >= 360 Then degrees = 0
            Dim a As Double = degrees * Math.PI / 180
            Dim x As Integer = 100 * Math.Cos(a) + 250
            Dim y As Integer = 100 * Math.Sin(a) + 250
            PictureBox1.Left = y
            PictureBox1.Top = x
        End Sub


    Chuck


    Chuck

    Wednesday, March 13, 2013 4:59 PM