Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27350

VS 2010 Draw a line in VB.NET (VS2012)

$
0
0
Hi all,

It drives me crazy but I can't get a line drawn into a form. The form keeps blank.
I'm sure it's easy but I'm still a junior developer so excuses me for that.


Code:

Imports System.Drawing
Imports System.Drawing.Drawing2D
.
.
.
    Public Sub DrawLine()
        Dim g As System.Drawing.Graphics = Me.CreateGraphics()
        Dim pen As New System.Drawing.Pen(System.Drawing.Color.Black, 10)
        g.DrawLine(pen, 20, 50, 50, 80)
        pen1.Dispose()
        g.Dispose()
    End Sub

I debug the program but the Form (Me) keeps blank. What I'm doing wrong?
There are several ways to do it but mainly I keep on reading the same code in several forums.

Viewing all articles
Browse latest Browse all 27350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>