Last post Feb 07, 2008 01:01 PM by oswazteca

• oswazteca

Member

10 Points

9 Posts

### Array of Points

Good day... i need an idea to my code:

```If iClickCounter = 1 Then
e.Graphics.DrawLine(pen, aPoints(0), aPoints(1), CInt(lblX.Text), CInt(lblY.Text))
gfx.Clear(Color.Transparent)
gfx.DrawLine(pen, aPoints(0), aPoints(1), CInt(lblX.Text), CInt(lblY.Text))
ElseIf iClickCounter = 2 Then
Dim p1 As New Point(aPoints(0), aPoints(1))
Dim p2 As New Point(aPoints(2), aPoints(3))
Dim p3 As New Point(CInt(lblX.Text), CInt(lblY.Text))
Dim Points As Point() = {p1, p2, p3}
e.Graphics.DrawCurve(pen, Points)
gfx.Clear(Color.Transparent)
gfx.DrawCurve(pen, Points)
ElseIf iClickCounter = 3 Then
Dim p1 As New Point(aPoints(0), aPoints(1))
Dim p2 As New Point(aPoints(2), aPoints(3))
Dim p3 As New Point(aPoints(4), aPoints(5))
Dim p4 As New Point(CInt(lblX.Text), CInt(lblY.Text))
Dim Points As Point() = {p1, p2, p3, p4}
e.Graphics.DrawCurve(pen, Points)
gfx.Clear(Color.Transparent)
gfx.DrawCurve(pen, Points)
ElseIf iClickCounter = 4 Then```
`...`
``` ElseIf iClickCounter = 12 Then
Dim p1 As New Point(aPoints(0), aPoints(1))
Dim p2 As New Point(aPoints(2), aPoints(3))
Dim p3 As New Point(aPoints(4), aPoints(5))
Dim p4 As New Point(aPoints(6), aPoints(7))
Dim p5 As New Point(aPoints(8), aPoints(9))
Dim p6 As New Point(aPoints(10), aPoints(11))
Dim p7 As New Point(aPoints(12), aPoints(13))
Dim p8 As New Point(aPoints(14), aPoints(15))
Dim p9 As New Point(aPoints(16), aPoints(17))
Dim p10 As New Point(aPoints(18), aPoints(19))
Dim p11 As New Point(aPoints(20), aPoints(21))
Dim p12 As New Point(aPoints(22), aPoints(23))
Dim p13 As New Point(CInt(lblX.Text), CInt(lblY.Text))
Dim Points As Point() = {p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13}
e.Graphics.DrawCurve(pen, Points)
gfx.Clear(Color.Transparent)
gfx.DrawCurve(pen, Points)

```

As you can see for every iClickCounter value y have to create a point to finally create the array, i have tried to add in a diferente way (as elements) but it brings the error that the array dosnt have the default property or standar property. I was thinking about a function but it will be the same endeless code.

An idea? Thank you so much...

function array code optimization points()

SQL Developer
• oswazteca

Member

10 Points

9 Posts

### Re: Array of Points

With the help of ecbruck i have solved the problem, now i can dinamicly add new elements (points) so now y can call a function.

```Dim points As New System.Collections.Generic.List(Of Point)