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.
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.
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
There are several ways to do it but mainly I keep on reading the same code in several forums.