Game Development Reference
Figure 21.1 Printer selection dialog in action.
Supporting Page Setup
Another common print feature provided by real-world applications is the ability
to choose page settings like the orientation of the paper or the margin sizes. This
can be done with the PageSetupDialog class and a stored instance of the PageSettings
class, as shown with the following code.
private void PageSetupButton_Click(object sender, EventArgs e)
PageSetupDialog pageSetupDialog = new PageSetupDialog();
if (cachedSettings == null)
cachedSettings = new PageSettings();
pageSetupDialog.PageSettings = cachedSettings;
You can now alter the printing logic to set the page settings to our cached instance,
as shown with the following code.
private void PrintButton_Click(object sender, EventArgs e)
using (StringReader inputText = new StringReader(PrintTextField.Text))