Printing a Graphics Object

E

ECVerify.com

I have a Graphics object in a control that has an image I want to
print...I want to print my already made Graphics object that I use in
a control, I try this

Private Sub pd_PrintPage(sender As Object, e As PrintPageEventArgs)
e.Grahpics = MyControl.MyGraphics
End Sub


When I do the problem is that e.Grahpics is read only.

How do I print what I already have ib memory without redrawing
everything on the e.Grahpics object?

Thanks, Ed,
 
K

Ken Tucker [MVP]

Hi,

I post a procedure that gets a windows or controls image from its
handle.

http://www.vb-helper.com/howto_net_get_window_image.html

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e
As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage

e.Graphics.DrawImage(GetWindowPicture(PictureBox1.Handle.ToInt32), 0, 0)

End Sub



Ken
 
E

ECVerify.com

Ken Tucker said:
Hi,

I post a procedure that gets a windows or controls image from its
handle.

http://www.vb-helper.com/howto_net_get_window_image.html

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e
As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage

e.Graphics.DrawImage(GetWindowPicture(PictureBox1.Handle.ToInt32), 0, 0)

End Sub



Ken

Thanks Ken,

Yes that is basically what I did,

Thanks again for your input,

Ed,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top