Click here to Skip to main content
15,917,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to create a dynamic List of Points, new Point ,can be added at any time. I want to draw lines to connect them using different color. Color is based on the ID's of those points, which will be retrieved from the database.
Posted
Comments
Sergey Alexandrovich Kryukov 23-Oct-12 16:04pm    
In console? forget it!
--SA

Create a Pen[^] of the appropriate color and use Graphics.DrawLine()[^] to draw a line using that Pen.  Be sure to properly dispose your objects, e.g.
PaintEventArgs pea = ...
using (Pen p = new Pen (...)) {
   pea.Graphics.DrawLine (...)
}

/ravi
 
Share this answer
 
This thing is not for console. Please see my past answers:
Drawing Lines between mdi child forms[^],
capture the drawing on a panel[^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^].

That was for System.Drawing, which is usually used with System.Windows.Forms or with bitmaps.

Alternative type of application is WPF. I don't have answer to your particular problem (for WPF, it is extremely simple), but you can get some ideas:
Connect different controls[^],
Vector graphics software like CorelDraw or Inkscape in C# or VB.NET[^].

Basically, you need to use the class System.Windows.Controls.Canvas and put some UI elements on it:
http://msdn.microsoft.com/en-us/library/system.windows.controls.canvas.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900