GDI - DrawLine problem....

  • Thread starter Thread starter Stu
  • Start date Start date
S

Stu

Hi,

Why does the code below only draw the last line of the loop? I was expecting
this to draw 10 parallel lines. More to the piont....how do I get it to draw
10 parallel lines?

Public Function GetImage() As Bitmap
Dim oBitmap As Bitmap = New Bitmap(200, 200)
Dim oGraphic As Graphics = Graphics.FromImage(oBitmap)
Dim oPen As New Pen(Color.Black, 4)
Dim i As Integer
For i = 0 To 10
oGraphic.DrawLine(oPen, i, 0, i, 150)
Next
Return oBitmap
End Function

Thanks in advance,

Stu
 
It doesn't draws only last line of the loop, since in your loop there is no
distance between lines it seems like a thick line.
use something like this loop to draw 10 parallel lines:
For i = 1 To 10
oGraphic.DrawLine(oPen, i * 15, 0, i * 15, 150)
Next

HTH
 
Back
Top