Picturebox

Résolu
1217meyrin Messages postés 159 Date d'inscription lundi 5 avril 2004 Statut Membre Dernière intervention 6 février 2007 - 11 sept. 2006 à 19:38
gallyhc Messages postés 386 Date d'inscription samedi 4 octobre 2008 Statut Membre Dernière intervention 19 février 2018 - 11 sept. 2006 à 20:10
Bonjour,
comment faire bouger un picturebox avec du code en x et y et peut-on faire bouger un picture selon un arc de cercle?
merci

1 réponse

gallyhc Messages postés 386 Date d'inscription samedi 4 octobre 2008 Statut Membre Dernière intervention 19 février 2018 2
11 sept. 2006 à 20:10
Bonjour,



<?xml:namespace prefix o ns "urn:schemas-microsoft-com:office:office" /??>
 




Tout d’abord pour faire bouger un picturebox cela est assai simple, il faut bouger sur les propriete X et Y qui sont « Left » et « Top ».



 




Pour le faire bouger en cercle c’est aussi simple faut juste savoir que toute rotation ce traduit par un cercle trigo. Donc tu as forcement un Cos et un Sin



 




Pour te donner un exemple voici un petit code :



 





Dim lngPX    As Long        ' POSITION X.





Dim lngPY    As Long        ' POSITION Y.





Dim lngMov  As Long         '





Dim lngLen  As Long         '






 






Private Sub Form_Load()




'



    lngPX = 1000            ' POSITIONNEMENT EN X DU PICTUREBOX.



    lngPY = 1000            ' POSITIONNEMENT EN Y DU PICTUREBOX.



    lngLen = 1000           ' TAILLE DU CERCLE.



 





End Sub






 






Private Sub Timer1_Timer()





'






    lngMov = lngMov + 100






    Picture1.Left lngPX + <?xml:namespace prefix st1 ns = "urn:schemas-microsoft-com:office:smarttags" /??><st1:place w:st="on">Cos</st1:place>(lngMov) * lngLen






    Picture1.Top = lngPX + Sin(lngMov) * lngLen






   






End Sub



 




Voila et bonne programmation,


[Gally Home Corp]
3
Rejoignez-nous