Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
10
Reply
How can I print each image seperately c#.net?
Mani Kandan
Jan 7 2017 11:39 AM
297
Reply
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.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
10
)
Next Recommended Forum
where we use multithreading in real time application
some invalid argument in system.drawing.graphics c#