podolis
Messages postés71Date d'inscriptionmardi 18 mars 2008StatutMembreDernière intervention19 décembre 2010
-
11 avril 2008 à 11:35
cs_antho2005
Messages postés150Date d'inscriptionsamedi 8 avril 2006StatutMembreDernière intervention 1 mai 2012
-
13 avril 2008 à 12:58
Je cherche à faire un zoom sur les coordonnées de ma souris (après un clique sur la picutrebox), pour le moment j'utilise ce code qui me permet juste de centré mon image mais pas de zoomé sur mes coordonnées
Rq : Ma pictureBox sur situe dans un panel
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Zoom
PictureBox1.Width = PictureBox1.Width * 1.2
PictureBox1.Height = PictureBox1.Height * 1.2
'Repositionnement de l'image par rapport au panel
PictureBox1.Left = (Panel1.Width - PictureBox1.Width) / 2
PictureBox1.Top = (Panel1.Height - PictureBox1.Height) / 2
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
PictureBox1.Width = PictureBox1.Width / 1.2
PictureBox1.Height = PictureBox1.Height / 1.2
PictureBox1.Left = (Panel1.Width - PictureBox1.Width) / 2
PictureBox1.Top = (Panel1.Height - PictureBox1.Height) / 2
End Sub
Ma souris me renvoi ces coordonnées sous deux variables x1 et y1
J'ai faguement l'impression qu'il s'agit plus d'un problème de maths que de programmation
Médéric
Ergonome Logiel
(VB.NET-Débutant)
cs_antho2005
Messages postés150Date d'inscriptionsamedi 8 avril 2006StatutMembreDernière intervention 1 mai 20123 12 avril 2008 à 11:17
De rien et désolé pour les espaces ... apparemment le forum a des petits problèmes quand c'est en bleu ou je sais pas trop pourquoi
par contre je pense que c'est plutôt
PositionDepart.X = LImage.Width / 2 - Coordonees.X * 2
PositionDepart.Y = LImage.Height / 2 - Coordonees.Y * 2
au lieu de
PositionDepart.X = LImage.Width / Facteur - Coordonees.X * Facteur
PositionDepart.Y = LImage.Height / Facteur - Coordonees.Y * Facteur
C'était un test que j'avais fait ...
En fait je sais pas trop
End
If
NewImage.DrawImage(LImage, PositionDepart.X, PositionDepart.Y, NouvelleTaille.Width, NouvelleTaille.Height)
Return PositionDepart
End
Function
Private
Sub PicConteneuse_MouseUp(
ByVal sender
As
Object,
ByVal e
As System.Windows.Forms.MouseEventArgs)
Handles
PicConteneuse.MouseUp
If Zoomer.Checked
Then
ZoomActu *= factor
Else
ZoomActu /= factor
End
If
LeDepart = ZoomerImage(PicConteneuse,
New Point(e.Location.X - LeDepart.X, e.Location.Y - LeDepart.Y), ZoomActu)
End
Sub
Private
Sub TailleDorigine_Click(
ByVal sender
As System.Object,
ByVal e
As System.EventArgs)
Handles TailleDorigine.Click
ZoomActu = 1
LeDepart = ZoomerImage(PicConteneuse,
New Point(0, 0), 1)
End
Sub
Après, je te laisse te débrouiller pour améliorer ça