PrintQueue is the printer the default printer?

2019-07-21 20:12发布

问题:

I'm making my own dialog for printing in my application, now I have this code to put all the printers in a combobox:

        PrintServer server = new PrintServer();

        foreach (PrintQueue queue in server.GetPrintQueues())
        {
            cboPrinters.Items.Add(queue.FullName);
        }

However, I would need select the default printer, how can I see which one is the default printer?

回答1:

i guess this link helps: How to determine the default printer using WPF?



回答2:

var DefaultPrinter = new LocalPrintServer().DefaultPrintQueue;