How to draw a line in visual basic .net 2005

Viewing 1 post (of 1 total)
  • Author
  • #3562

    how to draw a line in visual basic .net 2005

    There are two methods for drawing a line:
    1. we can use Graphices.DrawLine() method
    2. With the help of ‘Visual Basic PowerPacks.

    How to use Graphics.DrawLine() method:

    Suppose you want to draw a line on the form named form1, then you can use the following code sample on the _paint event like as:

        Private Sub Form1_Paint(ByVal sender As System.Object, _
    ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
            Dim grp As Graphics = e.Graphics
            grp.DrawLine(Pens.Blue, 100, 100, 200, 100)
        End Sub 

    if you want to draw line on the panel, then you can use panel1_paint event…

    Using PowerPacks:
    you can download powerPacks 2.0 for visual studio 2005 from

    and try Line shape.
    read this article about Line shape of powerpack :

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.