我正在将图像复制到剪贴板,如下所示:
using (MemoryStream ms = new MemoryStream())
{
chart1.SaveImage(ms, ChartImageFormat.Bmp);
Bitmap bm = new Bitmap(ms);
Clipboard.SetImage(bm);
}
如何打印图像?
答案 0 :(得分:3)
将您的位图传递给此方法:
void PrintBitmap(Bitmap bm)
{
PrintDocument doc = new PrintDocument();
doc.PrintPage += (s, ev) => {
ev.Graphics.DrawImage(bm, Point.Empty); // adjust this to put the image elsewhere
ev.HasMorePages = false;
};
doc.Print();
}
答案 1 :(得分:1)
使用Clipboard.GetImage()
功能从剪贴板获取图像,然后通常打印。 :)