Solved

How to print a Graphic object in c#

Posted on 2006-11-26
3
587 Views
Last Modified: 2012-06-21
what is the easiest way to print a graphic object.

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

thanx :)

0
Comment
Question by:Knightley
3 Comments
 
LVL 11

Expert Comment

by:Jase-Coder
Comment Utility
0
 
LVL 1

Author Comment

by:Knightley
Comment Utility
is there any example on this?
0
 
LVL 15

Accepted Solution

by:
ozymandias earned 50 total points
Comment Utility
// 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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now