123456789101112131415161718192021222324252627282930313233343536373839 |
- using CefSharp;
- using System;
- using System.Drawing.Printing;
- using System.Windows.Forms;
- namespace UAS_Web
- {
- public partial class PrinterList : Form
- {
- public IBrowser browser;
- public PrintDocument PrintDoc;
- public PrinterList(IBrowser br)
- {
- InitializeComponent();
- browser = br;
- PrintDoc = PrintFile;
- }
- private void PrinterList_Load(object sender, EventArgs e)
- {
- PrintDocument print = new PrintDocument();
- comboBox1.SelectedIndex = 0;
- string sDefault = print.PrinterSettings.PrinterName;//默认打印机名
- foreach (string sPrint in PrinterSettings.InstalledPrinters)//获取所有打印机名称
- {
- Printer.Items.Add(sPrint);
- if (sPrint == sDefault)
- Printer.SelectedIndex = Printer.Items.IndexOf(sPrint);
- }
- }
- private void PrinterList_Shown(object sender, EventArgs e)
- {
- TopMost = true;
- }
- }
- }
|