本文整理汇总了C#中System.Drawing.Printing.PrintPageEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# PrintPageEventArgs类的具体用法?C# PrintPageEventArgs怎么用?C# PrintPageEventArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PrintPageEventArgs类属于System.Drawing.Printing命名空间,在下文中一共展示了PrintPageEventArgs类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: printButton_Click
// Specifies what happens when the user clicks the Button.
private void printButton_Click(object sender, EventArgs e)
{
try
{
// Assumes the default printer.
pd.Print();
}
catch(Exception ex)
{
MessageBox.Show("An error occurred while printing", ex.ToString());
}
}
// Specifies what happens when the PrintPage event is raised.
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
{
// Draw a picture.
ev.Graphics.DrawImage(Image.FromFile("C:\\My Folder\\MyFile.bmp"), ev.Graphics.VisibleClipBounds);
// Indicate that this is the last page to print.
ev.HasMorePages = false;
}