Customize PrintDialog Window in WPF
Asked Answered
P

2

20

In my WPF application, I am going to print the contents of my ListBox. I want to add a new control to the PrintDialog box to select the number of lines (items) to print.

Is it possible to customize the existing PrintDialog box and add a new control to bind to ListBox.Count?

Or is there a better way to do this?

enter image description here

Psia answered 26/3, 2013 at 14:17 Comment(5)
Can you share with us the existing print dialog code with us ?Courtship
Why would anyone want to specify the number of lines to print? As opposed to say pages.Luo
@RameshMuthiah, by "existing PrintDialog", I'm pretty sure he means System.Windows.Controls.PrintDialog - so he wouldn't have any source code for that. I'm guessing he means "I want to add", instead of "I added".Shifty
@Daniel.Thanks.You are right.I have edited the question.Psia
@ Ryan Gates.Actually It is my project requirements.In mY project I have customised listbox and height of the each item in the list box is big in size.So it would be better to include "number of lines(items) to print" option.Psia
S
3

It's actually possible to extend common dialogs with .NET. I found this article on MSDN. However, I'm not sure whether this also applies to the print dialog or whether it can still be done, but I suggest you read that first.

Stroll answered 27/3, 2013 at 10:0 Comment(0)
H
1

"C# provides a standard PrintDialog which has all the basic print dialog functionality. Since it is declared as a sealed class, there is no way to extend it through C# native syntax."

Please see the following link: http://www.codeproject.com/Articles/16797/Extending-C-PrintDialog-Part-I

You can always create your own "Printing dialog screen" from scratch , then you can add your drop down with the ammount of lines to print(dropdown) witch you then get from the listbox(concatenating or build string) and send to a specified printer.

Hesler answered 27/3, 2013 at 9:56 Comment(1)
actually System.Windows.Forms.PrintDialog is sealed System.Windows.Controls.PrintDialog isn't!Fibrilliform

© 2022 - 2024 — McMap. All rights reserved.