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!

Recommended Answers

All 3 Replies

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?

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

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
commented: Nice execution... +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.