There are PrintDocument and Graphics classes.
Here is a small example:
private void printButton_Click(object sender, EventArgs e)
{
try
{
// Assumes the default printer.
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.Print();
}
catch(Exception e)
{
MessageBox.Show("Error occurred while printing", e.GetType() + e.Message);
}
}
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
// Draw image.
ev.Graphics.DrawImage(Image.FromFile("C:\\Program Files\\Images\\george.bmp", ev.Graphics.VisibleClipBounds);
// Indicate that this is the last page to print.
ev.HasMorePages = false;
}
-obislavu-
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.