473,320 Members | 1,854 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.

How to draw lines from vertices (x,y) (which i stored the value in arraylist)

19
Hi,

i need help on draw lines from vertices (vertex points that i stored the values in arraylist.
i already done the vertex points of shape and now my problem is to draw line between those vertices

i need to draw geometry connected lines example:

-Diamond- i already have the vertex values (which 4 points in x, y position)

-i get the values from the arraylist (stored)

- i need to draw line by connected all the 4 points

- and save the image.

really appreciate if someone could help me

Thanks
Jul 31 '10 #1
2 2799
in place of arraylist i recommend you using points array which directly save your points information and that can be used directly to draw lines between consecutive points. as an example
Expand|Select|Wrap|Line Numbers
  1.  Graphics gr = this.CreateGraphics();
  2.  Pen pen = new Pen(Color.Black, 1);
  3.  System.Drawing.Point[] pts = new Point[4];
  4.  pts[0] = new Point(20, 20);
  5.  pts[1] = new Point(20, 140);
  6.  pts[2] = new Point(60, 60);
  7.  pts[3] = new Point(180, 80);
  8.  gr.DrawPolygon(pen, pts);
  9.  
This will directly draw lines between 0th point to 1st point then 1st to 2nd then 2nd to 3rd and lastly 3rd to 0th. and if you want to draw any additional line between only two points say 0th point to 2nd point, you can use
Expand|Select|Wrap|Line Numbers
  1.  gr.DrawLine(pen,pts[0],pts[2]);
  2.  
Aug 6 '10 #2
aznimah
19
Thanks Rohit for the example ;)
Aug 17 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: taccea | last post by:
I need to print a report, but I need to first draw lines and boxes for the data. I need to do it at print time using VBA. How do I do this? Any suggestions appreciated. Taccea
0
by: JDeats | last post by:
Is it possible to use GDI+ to draw: lines, points, shapes, etc... inside a RichTextBox? It seems VS.NET does this with the code edit window (left margin code collapse/expand boxes)? Best, Jeremy
1
by: Ankita | last post by:
Hi I have a webservice which has 2 webmethods: 1.One that returns a String 2.One that returns an ArrayLis I need to use this WebService in VBA environment. I am using the Webservices References...
1
by: prakash437 | last post by:
Hello everyone .. Can any of you please tell me how to draw lines joining two points in a page using PHP. Not on an image but on the page itself?? And the lines also need to be at an angle to the...
9
by: zhaow | last post by:
Hi, All Greetings! I want to develop as appllication that requires a line-drawing function in the blank area between two forms. I have looked up the MSDN, it says that a graphics object need a...
1
by: weberwhennner | last post by:
Hi All, Since two days Ive been trying to draw lines and polygons interactively (using mouse clicks), but all ive found is some libraries that draw shapes using predefined cooredinates. Ive...
6
by: Nirosh | last post by:
Hi All, http://www.tourneylogic.com/Products/BracketControl/Demos/V2/PopularTourneys/NCAA.aspx Can some one tell me how he has draw lines here.. is it a trick done using DIV/ CSS or using the...
4
by: hastalavista | last post by:
HI I'm very new to C# and I've got a big project to do in C# for uni until july. I've been trying do draw lines in C# (arrows to be precise). I can draw them allright but once I minimize the...
0
by: Anuhas | last post by:
Dear Experts, I need to draw lines. But I have to make a class for this. I know how to draw lines in direct methods. i.e. Graphics g =...
0
by: krantik | last post by:
i need to draw lines like grid lines between images in a list control.i have used LVS_EX_GRIDLINES but its only working in report view .i need it in thumbnail view
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...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.