目前我正在使用以下代码打印图像:
private void button9_Click(object sender, EventArgs e)
{
PrintDocument pd = new PrintDocument();
printpath = "C:\\temp.bmp";
pd.PrintPage += new PrintPageEventHandler(Print_Page);
PrintPreviewDialog dlg = new PrintPreviewDialog();
dlg.Document = pd;
dlg.ShowDialog();
pd.Print();
}
private void Print_Page(object o, PrintPageEventArgs e)
{
Image i = Image.FromFile(printpath);
Point p = new Point(0, 0);
e.Graphics.DrawImage(i, p);
}
但如果图像的高度太大,则不适合页面。我想将图像分割成高度为1125像素的碎片,然后在打印预览中的多个页面上显示它们。我该怎么做呢?谢谢!