Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...