Home > Net >  Questions about Graphics printed
Questions about Graphics printed

Time:09-29

I now have such a piece of code


Dim MyPicGraphics As Graphics=PictureBox1. CreateGraphics

Dim PinkBrush As New SolidBrush (Color. Pink)

Dim BlackPen As New Pen (Brushes. Black) 'using the default brush width value of 1

'field on your form to fill in a solid oval

MyPicGraphics. FillEllipse (PinkBrush, New Rectangle (2, 2, 80, 50))

'to draw on in the form of a hollow oval

MyPicGraphics. DrawEllipse (BlackPen, New Rectangle (2, 2, 80, 50))

MyPicGraphics. DrawString (" test ", the New Font (" tahoma ", 20), New SolidBrush (Color. Blue), 50, 10)



The Graphics rendering, but now I want to print the Graphics content
I direct use: PrintDocument1. Print () type is empty, how should use?

CodePudding user response:

To painting in the graphics of printDouument1 again
Private Sub PrintDocument1_PrintPage (sender As Object, e As Printing. PrintPageEventArgs) Handles PrintDocument1. PrintPage
Um participant raphics. FillEllipse (... )
End Sub

CodePudding user response:

'get lasting image
Dim BMP as new bitmap (w, h)
Dim MyPicGraphics As Graphics=Graphics. Fromimage (BMP)
'according to
PictureBox1. Backimage=BMP
'in the printdoc drawing BMP

Um participant raphics. Drawimage (BMP... )
  • Related