Draw Line ---> Print (VB)

sinergy

New member
Joined
May 22, 2003
Messages
1
Draw Line ---> Print

I have a question, I am new to VB .NET and I tired to Print out a Line. The line now shows on the screen, but not on the printer.

Thats the source i have by now.

Dim font1 As New Font("Arial", 12, GraphicsUnit.Pixel)
Dim gr As Graphics = Me.CreateGraphics

Dim myPen As New Drawing.Pen(Color.Black, 1)


gr.DrawString("Arial 12 Regular", font1, Brushes.Black, 20, 20)
Dim x1 As Single = 100.0F
Dim y1 As Single = 100.0F
Dim x2 As Single = 500.0F
Dim y2 As Single = 100.0F
Draw line to screen.
gr.DrawLine(myPen, x1, y1, x2, y2)


Dim count
yPos = topMargin + count * printFont.GetHeight(ev.Graphics)
ev.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, yPos, New StringFormat())
count += 1
End Sub
 
Putting graphics on a PrintDocument is just like putting graphics on a screen. You have to draw it on the PrintDocument where you want it.
 
Back
Top