OKIEWARDOYO

VISUAL C# No.48 3

Sep 6th, 2014
3,609
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. private void btnProperties_Click(object sender, EventArgs e)
  2. {
  3.     if (printerList.Text == string.Empty)
  4.     {
  5.         MessageBox.Show("Select a Printer from the list please");
  6.         return;
  7.     }
  8.  
  9.     string mySelectedPrinter = printerList.SelectedItem.ToString();
  10.     PrinterSettings myPrinterSettings = new PrinterSettings();
  11.     myPrinterSettings.PrinterName = mySelectedPrinter;
  12.  
  13.     //get PaperSize
  14.     foreach (PaperSize PrSize in myPrinterSettings.PaperSizes)
  15.     {
  16.         comboBoxPaperSize.Items.Add(PrSize.ToString());
  17.     }
  18.  
  19.     //get PrinterResolution
  20.     foreach (PrinterResolution PrResolution in myPrinterSettings.PrinterResolutions)
  21.     {
  22.         comboBoxResolution.Items.Add(PrResolution.ToString());
  23.     }
  24.  
  25.     groupBoxProperties.Visible = true;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment