Re sa avance un peu la,
Je me suis dirigé vers une application VB.NET finalement
car la classe drawing n'est pas accessible dans un environnement web
La chaine pour créer le tableau de point ressemble a sa:
"x1,y1,x2,y2,xn,yn"
chaine constuite a l'aide de:
1 2 3 4 5 6
| LocalMousePosition = PictureBox1.PointToClient(Cursor.Position)
If mCh = "" Then
mCh = LocalMousePosition.X & "," & LocalMousePosition.Y
Else
mCh = mCh & "," & LocalMousePosition.X & "," & LocalMousePosition.Y
End If |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| Public Function get_tableau(ByRef chaine As String)
Dim chaine_bis As String : chaine_bis = chaine
Dim taille As Integer = -1
Dim coordonnée As Point
Dim position As Integer
Dim tab As New ArrayList
Dim Y, X As String
Dim i As Integer : i = 0
While (chaine_bis.Contains(",") = True)
position = chaine_bis.LastIndexOf(",")
Y = chaine_bis.Substring(position + 1)
coordonnée.Y = CInt(Y)
chaine_bis = chaine_bis.Remove(position)
position = chaine_bis.LastIndexOf(",")
X = chaine_bis.Substring(position + 1)
coordonnée.X = CInt(X)
If (position = -1) Then
position = 0
End If
chaine_bis = chaine_bis.Remove(position)
tab.Add(coordonnée)
taille = taille + 1
i = i + 1
End While
Dim tab_pt(taille) As System.Drawing.Point
tab.CopyTo(tab_pt)
Return tab_pt
End Function |
polygone constuit comme sa :
e.Graphics.DrawPolygon(Pens.Black, get_tableau(mCh))
Voila si sa vous interesse.
Partager