VB.Net PictureBox refresh

cs_JeffC1977 Messages postés 928 Date d'inscription vendredi 10 novembre 2000 Statut Membre Dernière intervention 23 septembre 2023 - 25 sept. 2007 à 16:43
cs_JeffC1977 Messages postés 928 Date d'inscription vendredi 10 novembre 2000 Statut Membre Dernière intervention 23 septembre 2023 - 25 sept. 2007 à 19:02
Salut à tous...

Je fais dessiner des croix dans un picturebox... Au démarrage de l'aplication mes croix son correct, ils ont de l'air d'être des croix.
J'utilise un Trackbar et si je zoom mais croix devienne de plus en plus laide (afreuse). Je voix les pixel de la croix...  je dois pour mon application garder la même proportion de mes croix. À chque fois que j'utilise le zoom (Trackbar) je fais redessiner mes points, mais ils se dessinne de plus en plus grosse.

Si vous pouvez me dire ce qui cloche

merci

Private

Sub TrackBar1_ValueChanged(
ByVal sender
As System.Object,
ByVal e
As System.EventArgs)
Handles TrackBar1.ValueChanged

If Count = 0
Then
Trackbar = 0
Count = Count + 1

End
If

If Trackbar < TrackBar1.Value
Then
PictureBox1.Height = Y_initial + (50 * TrackBar1.Value)
PictureBox1.Width = X_initial + (50 * TrackBar1.Value)
Trackbar = TrackBar1.Value

ElseIf Trackbar > TrackBar1.Value
Then
If TrackBar1.Value = 0
Then
PictureBox1.Height = 220
PictureBox1.Width = 220

Else
PictureBox1.Height = PictureBox1.Height - (50 * TrackBar1.Value)
PictureBox1.Width = PictureBox1.Width - (50 * TrackBar1.Value)
Trackbar = TrackBar1.Value

End
If
End
If

Dim i
As
IntegerX_initial = PictureBox1.Width
Y_initial = PictureBox1.Height
objGraphics = Graphics.FromImage(objBitMap)
objGraphics.Clear(Color.White)

For i = 0
To UBound(Tableau)
LigneSplit = Tableau(i).Split(Separateur)
CoordXPicturebox = (Convert.ToDouble(LigneSplit(2) - ValMinX) * EchelleX)
CoordYPicturebox = (Convert.ToDouble(LigneSplit(1) - ValMinY) * EchelleY)
objGraphics.DrawLine(MyPen, CoordXPicturebox, CoordYPicturebox - 2, CoordXPicturebox, CoordYPicturebox + 2)
objGraphics.DrawLine(MyPen, CoordXPicturebox - 2, CoordYPicturebox, CoordXPicturebox + 2, CoordYPicturebox)

Next i

Me.PictureBox1.Image = objBitMap
objGraphics.Dispose()
objGraphics =
Nothing
End
Sub

1 réponse

cs_JeffC1977 Messages postés 928 Date d'inscription vendredi 10 novembre 2000 Statut Membre Dernière intervention 23 septembre 2023 4
25 sept. 2007 à 19:02
Re...


J'ai oublié, j'ai cette déclaration public mit dans un Module

Public objBitMap
As
New Bitmap(PictureBox1.Width, PictureBox1.Height)

Je crois que mes croix ne se dessinent pas bien car elles gardent la résolution de départ du picturebox...

Comment faire pour changer le Width et le Height de objBitMap ???

objBitMap.Width = X_initial 'Ca marche pas mais comment faire
0
Rejoignez-nous