My C# program allows the user to choose which of several similarly named printers they wish to print some labels to. The standard PrintDialog is fairly narrow compared to the printer names it has to display, so you can't see the full names of all the printers in the drop-down list. Is there a way to increase the width of the PrintDialog form? Since it's a dialog, it's not resizable at run-time. I'd really rather not reinvent the wheel and come up with a brand new form just to enumerate installed printers, small as that task seems.
Asked
Active
Viewed 653 times
2
-
Is the only thing the PrintDialog is doing is selecting a printer? What I mean is, no other options are needed, paper size, copies etc.. – General Grey May 22 '12 at 15:00
-
@K'Leg That's the only thing I'm using it for. I've disabled all the other options that I can (paper size, print selection, etc). I know it would be fairly simple to create custom form, but this seems like a common scenario, and it's hard for me to believe that with everybody using network printers, which seem to have longer names, there's no way for the built-in controls to accommodate printer names "of a certain size". – Sam Skuce May 22 '12 at 15:14
-
The printer Names on my network are not long at all. It's a long shot but can YOU reduce the size of the Printer Names? – General Grey May 22 '12 at 15:20
-
PrintDialog is a standard Windows dialog, it is the same for any program that displays it. Compare with, say, Notepad's File + Print dialog. You cannot easily replace it or resize it. Given that *all* programs would have a problem showing enough of the printer names, pursuing short printer names would be the logical solution. – Hans Passant May 22 '12 at 17:35
1 Answers
1
You obviously know how to create your own Form so I wont suggest that to you.
But what about adding a combobox, somewhere near your print button, and populate it like this.
I suggest making the combobox dropdwon only, that way users cannot add their own printer name and F*** it all up.
foreach (string s in PrinterSettings.InstalledPrinters)
{
comboBox1.Items.Add(s);
}

General Grey
- 3,598
- 2
- 25
- 32