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!

3
Contributors
3
Replies
5
Views
6 Years
Discussion Span
Last Post by codeorder
Featured Replies
  • Have a look at [URL="http://en.allexperts.com/q/VB-NET-3306/Drawing-line-VB-net.htm"]THIS[/URL] site. It has some useful links as well which might help in solving your problem. Read More

  • See if this helps. [CODE]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, … Read More

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?

2

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
Comments
Nice execution...
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.