2

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.

4
  • 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.. May 22, 2012 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, 2012 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? May 22, 2012 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. May 22, 2012 at 17:35

1 Answer 1

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);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.