954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Straight line and dots

Hi everyone, I'm in this proyect where I need an area in the form where I can place just dots, then join these dots with an straight line between them.

How can I do that? I placed a Picturebox to see functions there but nothing is clear. Any help would be great, thanks!

Pundia
Newbie Poster
21 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

Hi everyone, I'm in this proyect where I need an area in the form where I can place just dots, then join these dots with an straight line between them.

How can I do that? I placed a Picturebox to see functions there but nothing is clear. Any help would be great, thanks!


Can someone tell me at least which control can I use? I picturebox fine for this purpouse?

Pundia
Newbie Poster
21 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

Have a look at THIS site. It has some useful links as well which might help in solving your problem.

AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
 

See if this helps.

Public Class Form1

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim myGraphics As Graphics = e.Graphics
        '// draw Dots.
        Dim myDotPen As New Pen(Color.SteelBlue, 10) '// set DOT pen color and width.
        myGraphics.DrawEllipse(myDotPen, 25, 25, 10, 10) '// (preset pen, location.X, location.Y, width, height)
        myGraphics.DrawEllipse(myDotPen, 75, 25, 10, 10) '// (preset pen, location.X, location.Y, width, height)
        myGraphics.DrawEllipse(myDotPen, 125, 25, 10, 10) '// (preset pen, location.X, location.Y, width, height)
        '// draw Line.
        Dim myLinePen As New Pen(Color.SpringGreen, 5) '// set LINE pen color and width.
        myGraphics.DrawLine(myLinePen, 28, 30, 132, 30) '// (preset pen, startLocation.X, startLocation.Y, endLocation.X, endLocation.Y)
        '// dispose if not needed.
        myGraphics.Dispose() : myDotPen.Dispose() : myLinePen.Dispose()
    End Sub
End Class
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: