Hello
I want to print list of images from list as shown below,
I have tried,
On button click,
- int currentPage;
- ArrayList ListViewItemsData = new ArrayList() { };
- private void btn_click(object sender, MouseButtonEvertArgs e)
- {
- PrintDocument pd = new PrintDocument();
- pd.PrintPage += new PrintPageEventHandler(PrintImageHandler);
- System.Windows.Forms.PrintDialog pdi = new System.Windows.Forms.PrintDialog();
- pdi.Document = pd;
- if (pdi.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- pd.Print();
- }
- }
-
- private void PrintImageHandler(object sender, PrintPageEventArgs ppeArgs)
- {
-
- Graphics g = ppeArgs.Graphics;
- System.Drawing.Image objimage = System.Drawing.Image.FromFile(ListViewItemsData[currentPage].ToString());
- g.DrawImage(objimage, 50, 50, objimage.Width, objimage.Height);
- currentPage++;
- if (currentPage < ListViewItemsData.Count)
- {
- objimage = System.Drawing.Image.FromFile(ListViewItemsData[currentPage].ToString());
- g.DrawImage(objimage, 100, 300, objimage.Width, objimage.Height);
- currentPage++;
- }
- ppeArgs.HasMorePages = currentPage < ListViewItemsData.Count;
- }
How can I do this? Please help me.