cs_JeffC1977
Messages postés928Date d'inscriptionvendredi 10 novembre 2000StatutMembreDernière intervention23 septembre 20234 6 sept. 2007 à 22:16
j'ai essayé mais ca cause 3 erreurs et si je ne mets pas le (0,0,100,100) j'ai une seule erreur qui dit :
'System.Drawing.RectangleF' cannot be converted to System.Drawing.Rectangle'.
Voir ce qui est en gras et en souligné
Merci de ton aide
Private
Sub BtnCercle_Click(
ByVal sender
As System.Object,
ByVal e
As System.EventArgs)
Handles cmdDessin.Click
Dim objBitMap
As
New Bitmap(PictureBox1.Width, PictureBox1.Height)
Dim objGraphics
As Graphics
Dim MonRectable
As RectangleF
Dim MaBrush
As Brush
Dim i
As
Integer
Dim CoordX
As
Double, CoordY
As
Double
For i = 0
To UBound(Tableau)
LigneSplit = Tableau(i).Split(Separateur)
CoordX = ((Convert.ToDouble(LigneSplit(2)) + 5000) / 1000)
CoordY = ((Convert.ToDouble(LigneSplit(1)) + 5000) / 1000)
objGraphics = Graphics.FromImage(objBitMap)
MonRectable =
New RectangleF(CoordX, CoordY.ToString, 1, 1)
MaBrush =
New SolidBrush(Color.Blue)
If i = 0
Then objGraphics.Clear(Color.White)
objGraphics.FillEllipse(MaBrush, MonRectable )
Me.PictureBox1.Image = objBitMap
objGraphics.Dispose()
objGraphics =
Nothing
Next i
cs_Stephane33
Messages postés630Date d'inscriptionsamedi 15 février 2003StatutModérateurDernière intervention 9 octobre 20111 6 sept. 2007 à 22:39
Dim
MonRectable
As
Rectangle
MonRectable =
New
Rectangle(CoordX, CoordY.ToString, 1, 1)
En fait la différence entre RectangleF et Rectangle c'est la précision. RectangleF accepte la virgule Flottante et pas Rectangle.
Visiblement la fonction FillElipse n'accepte que Rectangle
pour
If
i = 0
Then
objGraphics.Clear(Color.White)
Tu instancie un nouveau bitmap donc tu n'est pas obligé de l'effacer
et place le plutôt avant
Private
Sub
BtnCercle_Click(
ByVal
sender
As
System.Object,
ByVal
e
As
System.EventArgs)
Handles
cmdDessin.Click
Dim
objBitMap
As
New
Bitmap(PictureBox1.Width, PictureBox1.Height)
Dim
objGraphics
As
Graphics
Dim
MonRectable
As
Rectangle
Dim
MaBrush
As
Brush
Dim
i
As
Integer
Dim
CoordX
As
Double
, CoordY
As
Double
objGraphics = Graphics.FromImage(objBitMap) 'Une fois cela suffit
objGraphics.Clear(Color.White) 'Cela ajoute peint le fond en blanc
MaBrush =
New
SolidBrush(Color.Blue)
'Une fois cela suffit
For
i = 0
To
UBound(Tableau)
LigneSplit = Tableau(i).Split(Separateur)
cs_JeffC1977
Messages postés928Date d'inscriptionvendredi 10 novembre 2000StatutMembreDernière intervention23 septembre 20234 7 sept. 2007 à 11:38
Salut j'avais remarquer le doublons... héhéhé
Mais j'ai encore le même problème c'est-à-dire
On dirais que le le code n'aime pas le RectangleF, mais j'en ai besoin, j'ai besoin d'avoir des décimaux pour les coordoonées
J'attends ton aide
Private
Sub BtnCercle_Click(
ByVal sender
As System.Object,
ByVal e
As System.EventArgs)
Handles cmdDessin.Click
Dim objBitMap
As
New Bitmap(PictureBox1.Width, PictureBox1.Height)
Dim objGraphics
As Graphics
Dim MonRectable
As RectangleF
Dim MaBrush
As Brush
Dim i
As
Integer
Dim CoordX
As
Double, CoordY
As
DoubleobjGraphics = Graphics.FromImage(objBitMap)
objGraphics.Clear(Color.White)
MaBrush =
New SolidBrush(Color.Blue)
For i = 0
To UBound(Tableau)
LigneSplit = Tableau(i).Split(Separateur)
CoordX = ((Convert.ToDouble(LigneSplit(2)) + 5000) / 1000)
CoordY = ((Convert.ToDouble(LigneSplit(1)) + 5000) / 1000)
MonRectable =
New RectangleF(CoordX, CoordY.ToString, 1, 1)
objGraphics.FillEllipse(MaBrush, MonRectable ) 'Error 2 Value of type 'System.Drawing.RectangleF' cannot be converted to 'System.Drawing.Rectangle'
Next i
Me.PictureBox1.Image = objBitMap
objGraphics.Dispose()
objGraphics =
Nothing
End
Sub
cs_Stephane33
Messages postés630Date d'inscriptionsamedi 15 février 2003StatutModérateurDernière intervention 9 octobre 20111 8 sept. 2007 à 22:04
Au niveau précision c'est clair, mais là pour ta représentation graphique, soit tu fais du Plein avec Rectangle, soit tu fais vide avec RectangleF et DrawEllipse
cs_JeffC1977
Messages postés928Date d'inscriptionvendredi 10 novembre 2000StatutMembreDernière intervention23 septembre 20234 10 sept. 2007 à 13:18
ok J'ai encore un peu de difficult.é avec ces notions
Je doit absolument utiliser RectangleF. Je m'en fou d'avoir un rond plein. Bref j'ai besoin d'un élément ponctuel afin de représenté chaque coordonnées. Que me suggères-tu ???
Je peux mettre une croix enfin n'importe quoi qui va représenté chaque coordonnée par un éléments quelconque.
cs_Stephane33
Messages postés630Date d'inscriptionsamedi 15 février 2003StatutModérateurDernière intervention 9 octobre 20111 10 sept. 2007 à 17:58
"Je peux mettre une croix"
Une croix c'est deux lignes
Dim MonPoint as pointF
Const TailleCroix as integer = 2
Dim Crayon as New Pen(Color.Black,1)
..........
MonPoint.X
= ((Convert.ToDouble(LigneSplit(2)) + 5000) / 1000)
MonPoint.Y = ((Convert.ToDouble(LigneSplit(1)) + 5000) / 1000)
For i = 0
To UBound(Tableau)
LigneSplit = Tableau(i).Split(Separateur)
Dim Point1 as new PointF(
((Convert.ToDouble(LigneSplit(2)) + 5000) / 1000),
CoordY = ((Convert.ToDouble(LigneSplit(1)) + 5000) / 1000))
DrawCroix(objGraphics,Point1)
cs_Stephane33
Messages postés630Date d'inscriptionsamedi 15 février 2003StatutModérateurDernière intervention 9 octobre 20111 10 sept. 2007 à 21:02
"En fait la différence entre RectangleF et Rectangle
c'est la précision. RectangleF accepte la virgule Flottante et pas
Rectangle.
Visiblement la fonction FillElipse n'accepte que Rectangle"