473,320 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DrawLine and data structure

I am trying to draw a long line. I have store the data in:

Structure MapPoint

Public GridEast As Single

Public GridNorth As Single

End Structure

Dim SouthIsland(1747) As MapPoint

To draw the line I was go to use:

Dim pn As Pen = New Pen(Color.DarkGreen, 1)

Dim points As Point() = {New Point(10, 10), New Point(10, 100), New
Point(200, 50), New Point(250, 300)}

e.Graphics.DrawLines(pn, points)

How do I get SouthIsland.GridEast() & SouthIsland.GridNorth() into Point()?

I could type in all 1747 like below, but there must be a better way.

Dim points As Point() = {New SouthIsland(0), New SouthIsland(1),...}

Simon
Nov 20 '05 #1
7 1119

point.x= mappoint.GridNorth
point.y=mapPoint.grid,East

Simon Morris wrote:
I am trying to draw a long line. I have store the data in:

Structure MapPoint

Public GridEast As Single

Public GridNorth As Single

End Structure

Dim SouthIsland(1747) As MapPoint

To draw the line I was go to use:

Dim pn As Pen = New Pen(Color.DarkGreen, 1)

Dim points As Point() = {New Point(10, 10), New Point(10, 100), New
Point(200, 50), New Point(250, 300)}

e.Graphics.DrawLines(pn, points)

How do I get SouthIsland.GridEast() & SouthIsland.GridNorth() into
Point()?

I could type in all 1747 like below, but there must be a better way.

Dim points As Point() = {New SouthIsland(0), New SouthIsland(1),...}

Simon

Nov 20 '05 #2
"Simon Morris" <si**********@xtra.co.nz> schrieb
I am trying to draw a long line. I have store the data in:
Structure MapPoint
Public GridEast As Single
Public GridNorth As Single
End Structure

Dim SouthIsland(1747) As MapPoint

To draw the line I was go to use:

Dim pn As Pen = New Pen(Color.DarkGreen, 1)

Dim points As Point() = {New Point(10, 10), New Point(10, 100),
New Point(200, 50), New Point(250, 300)}

e.Graphics.DrawLines(pn, points)

How do I get SouthIsland.GridEast() & SouthIsland.GridNorth() into
Point()?

I could type in all 1747 like below, but there must be a better
way.

Dim points As Point() = {New SouthIsland(0), New
SouthIsland(1),...}


I would write a loop.
--
Armin

http://learn.to/quote
http://www.plig.net/nnq/nquote.html

Nov 20 '05 #3
Cor
Hi Armin,

Such an endless one as this
Until everybody has learned how to quote I keep my quote
Loop
I would write a loop.

http://learn.to/quote
http://www.plig.net/nnq/nquote.html

Nov 20 '05 #4
Cor
Armin,
I forgot :-))
Of course
Cor
Nov 20 '05 #5
* "Simon Morris" <si**********@xtra.co.nz> scripsit:
I am trying to draw a long line. I have store the data in:

Structure MapPoint
Public GridEast As Single
Public GridNorth As Single
End Structure

Dim SouthIsland(1747) As MapPoint

To draw the line I was go to use:

Dim pn As Pen = New Pen(Color.DarkGreen, 1)

Dim points As Point() = {New Point(10, 10), New Point(10, 100), New
Point(200, 50), New Point(250, 300)}

e.Graphics.DrawLines(pn, points)

How do I get SouthIsland.GridEast() & SouthIsland.GridNorth() into Point()?

I could type in all 1747 like below, but there must be a better way.

Dim points As Point() = {New SouthIsland(0), New SouthIsland(1),...}


\\\
ReDim points(SouthIsland.Length - 1)
Dim i As Integer
For i = 0 To SouthIsland.Length - 1
point(i) = SouthIsland(i)
Next i
///

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #6
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb
* "Simon Morris" <si**********@xtra.co.nz> scripsit:
I am trying to draw a long line. I have store the data in:

Structure MapPoint
Public GridEast As Single
Public GridNorth As Single
End Structure

Dim SouthIsland(1747) As MapPoint

To draw the line I was go to use:

Dim pn As Pen = New Pen(Color.DarkGreen, 1)

Dim points As Point() = {New Point(10, 10), New Point(10, 100),
New Point(200, 50), New Point(250, 300)}

e.Graphics.DrawLines(pn, points)

How do I get SouthIsland.GridEast() & SouthIsland.GridNorth() into
Point()?

I could type in all 1747 like below, but there must be a better
way.

Dim points As Point() = {New SouthIsland(0), New
SouthIsland(1),...}


\\\
ReDim points(SouthIsland.Length - 1)
Dim i As Integer
For i = 0 To SouthIsland.Length - 1
point(i) = SouthIsland(i)
Next i
///

Very close. ;-)

ReDim points(SouthIsland.Length - 1)
Dim i As Integer
For i = 0 To SouthIsland.Length - 1
points(i).x = CInt(SouthIsland(i).GridEast)
points(i).y = CInt(SouthIsland(i).GridNorth)
Next i

--
Armin

http://learn.to/quote
http://www.plig.net/nnq/nquote.html

Nov 20 '05 #7
* "Armin Zingler" <az*******@freenet.de> scripsit:
Very close. ;-)

ReDim points(SouthIsland.Length - 1)
Dim i As Integer
For i = 0 To SouthIsland.Length - 1
points(i).x = CInt(SouthIsland(i).GridEast)
points(i).y = CInt(SouthIsland(i).GridNorth)
Next i


Thanks... I missed that the type of the points in 'SouthIsland' was
'MapPoint' *lookingformyglasses*.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jon Cosby | last post by:
I'm using this to draw rectangles in a PictureBox image. Not all of the rectangles are complete, and after drawing several, some of them start disapearing. What's the reason for this? Pen...
1
by: Rich | last post by:
Hello, I am trying to draw a graph on a form. I can draw the box using drawline, and bars inside the box using drawrectangle, but when I try to draw a line inside the box the inner lines are...
4
by: Smoke | last post by:
It is possible to draw a line on a control using AA? basically, i need the normal .DrawLine funcion but that support antia aliasing. is this possible? can somebody tellme how? Thanks for the...
2
by: google_groups3 | last post by:
Hi, is it better practise to draw a line on my form using the Graphics.DrawLine command or should I use a label control instead? I am refering to overall speed of the form and amount of memory...
2
by: John | last post by:
I created a number of pictureboxes in a panel, and want to draw lines in those pictureboxes but I cannot. Please see the following code and make corrections. Thanks. Private Sub...
0
by: Lila Godel | last post by:
I am migrating my VB6 GoldMine add-ons to VB.NET to allow for enhancements. I have no problem getting text to print, but I cannot get the 4 PrintPage events that are needed to print a line to work....
2
by: Stu | last post by:
Hi, Why does the code below only draw the last line of the loop? I was expecting this to draw 10 parallel lines. More to the piont....how do I get it to draw 10 parallel lines? Public...
3
by: Ben Bush | last post by:
I had the following code and when I clicked the left mouse button one time. I got green line and the second click got a purple line and the green disappeared. I was confused by two questions:...
2
by: intrepid_dw | last post by:
All I am writing a C# WinForms application which is giving me some problems. The application consists of a form containing an empty Tab control to which TabPages are added dynamically (at...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.