如何打印列表c#.net WPF中的所有图像? [英] How to print all images from list c#.net WPF?
本文介绍了如何打印列表c#.net WPF中的所有图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我有一个来自数据库的图像列表,包含imagename和imagepath。
如何通过显示打印每个图像打印对话框?
请帮帮我...
我尝试过的方法:
Hello,
I have a list of image from database with imagename and imagepath.
How can I print each image through showing Print Dialog ?
Please help me...
What I have tried:
if (objTble_Documents.Count() != 0)
{
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(PrintPage);
System.Windows.Forms.PrintDialog pdi = new System.Windows.Forms.PrintDialog();
pdi.Document = pd;
if (pdi.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
pd.Print();
}
else
{
MessageBox.Show("Print Cancelled");
}
}
private void PrintPage(object o, PrintPageEventArgs e)
{
foreach (var i in objTble_Documents)
{
objListViewItemsData.Add(new ListViewItemsData()
{
GridViewColumnName_ImageSource = (Convert.ToString(i.FilePath) + Convert.ToString(i.Parent_File_Name) + "_" + Convert.ToString(i.Child_File_Name)),
});
}
System.Drawing.Image img = System.Drawing.Image.FromFile("?");/*Here How can I add all images from 'objListViewItemsData' list*/
System.Drawing.Point loc = new System.Drawing.Point(100, 100);
e.Graphics.DrawImage(img, loc);
}
推荐答案
您已在如何在WPF c#.net中打开打印机窗口? [ ^ ],目前还不清楚你的问题是什么。
You already posted this question at How can I open printer window in WPF c#.net?[^], and it is still not clear what your problem is.
这篇关于如何打印列表c#.net WPF中的所有图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文