drawing a line on a form

  • Thread starter Thread starter Vergassivellaunus
  • Start date Start date
V

Vergassivellaunus

Guest
In the goal of drawing fast lines, i tested this on a form and button:

Public myPen As Pen
Public n As Integer
Public x, length, xprec As Long
Public myGraphics As Graphics = Me.CreateGraphics

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

length = 2000

myPen = New Pen(Drawing.Color.Red, 1)

For n = 0 To length - 1
x = n
myGraphics.DrawLine(myPen, n, xprec, n + 1, x)
xprec = x
Next

myPen.Dispose()
myGraphics.Dispose()
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Width = 500
Me.Height = 500
End Sub


The result should be a line from top left to down right. But it stops at some point. It seems that the area for drawing is limited

to up left. Why? If i resize to much less i get the line running well, but i'm cheeting.

Enzo

Continue reading...
 
Back
Top