Skip to content

Instantly share code, notes, and snippets.

@SarasArya
Created October 15, 2023 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SarasArya/21b899dda3fb6e4a6c4027a86e16b749 to your computer and use it in GitHub Desktop.
Save SarasArya/21b899dda3fb6e4a6c4027a86e16b749 to your computer and use it in GitHub Desktop.
Printer Settings in C#
string selectedPrinter = "";
selectedPrinter = BilzoLogs.ReadValueFromRegistry("PrinterName");
m_prefPaperSize = BilzoLogs.ReadValueFromRegistry("PaperSize");
m_centerAlign = BilzoLogs.ReadValueFromRegistry("CenterAlign");
m_printType = BilzoLogs.ReadValueFromRegistry("PrintType");
int selectedIndex = -1;
int paperSizeSelIdx = -1;
int index = 0;
foreach (string printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
{
if (printer != "Bilzo")
{
printersCombo.Items.Insert(index, printer);
if (selectedPrinter == printer)
selectedIndex = index;
index++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment