How to print a Graphic object in c#

what is the easiest way to print a graphic object.

(I have used the graphic object to display some bmp files)

thanx :)

LVL 1
KnightleyAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ozymandiasConnect With a Mentor Commented:
// create a document
PrintDocument pd = new PrintDocument();
//bind a delegate to its print page event
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
// create a print dialog
PrintDialog pDlg = new PrintDialog();
// give it the document
pDlg.Document = pd;
// show it
pDlg.ShowDialog(this);


// here's our delegate method
private void pd_PrintPage(object sender, PrintPageEventArgs e) {
    // get the graphics of the print document
    Graphics g = e.Graphics;
    // here draw your image onto the graphics using g.DrawImage() or whatever suits you
    // tell the print dialog there are no more pages
    e.HasMorePages = false;
}
0
 
Jase-CoderCommented:
0
 
KnightleyAuthor Commented:
is there any example on this?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.