TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abhilash J A
537
2.4k
596k
How can I open printer window in WPF C#.Net
Dec 23 2016 1:50 PM
Hello everyone,
I have list images from database. And I want to print the images. But I can not do, showing printer window by using below c# code. How can open printer window something like that...
After binding my DataGrid with images that show like that...
private
void
Img_PrintlistDoc_MouseLeftButtonDown1(
object
sender, MouseButtonEventArgs e)
{
PrintDocument pd =
new
PrintDocument();
pd.PrintPage += PrintPage;
pd.Print();
}
private
void
PrintPage(
object
o, PrintPageEventArgs e)
{
DMSBusinessLayer service =
new
DMSBusinessLayer();
List<DocumentsUser> objTble_Documents =
new
List<DocumentsUser>();
int
UserId = 0;
string
ImgName =
string
.Empty;
foreach
(DocumentsUser item
in
listView1.SelectedItems)
{
UserId = Convert.ToInt32(item.UserId);
ImgName = item.Parent_File_Name;
objTble_Documents = service.PrintUserDocuments(ImgName, UserId).AsEnumerable().Select(m =>
new
DocumentsUser()
{
Child_File_Name = m.Field<
string
>(
"Child_File_Name"
),
FilePath = m.Field<
string
>(
"FilePath"
),
Parent_File_Name = m.Field<
string
>(
"Parent_File_Name"
)
}).ToList();
var items = objTble_Documents.SelectMany((x) =>
new
[]
new
{Child_File_Name = x.Child_File_Name,FilePath = x.FilePath,Parent_File_Name = x.Parent_File_Name}});
foreach
(var i
in
items)
{
System.Drawing.Image img = System.Drawing.Image.FromFile(Convert.ToString(i.FilePath) + Convert.ToString(i.Parent_File_Name) +
"_"
+ Convert.ToString(i.Child_File_Name));
System.Drawing.Point loc =
new
System.Drawing.Point(100, 100);
e.Graphics.DrawImage(img, loc);
}
}
}
Kindly advice me... Please...
Reply
Answers (
3
)
How to add service known type in app config file?
WCF runtime exception.