c# 调用本地打印机

版权声明: https://blog.csdn.net/weixin_42380000/article/details/84993236

查询本机所有打印机

 private void index_Load(object sender, EventArgs e)
        {
            PrintDocument print = new PrintDocument();
            string sDefault = print.PrinterSettings.PrinterName;//默认打印机名
            foreach (string sPrint in PrinterSettings.InstalledPrinters)//获取所有打印机名称
            {
                cbPrinter.Items.Add(sPrint);
                if (sPrint == sDefault)
                    cbPrinter.SelectedIndex = cbPrinter.Items.IndexOf(sPrint);
            }
        }
展开阅读全文

没有更多推荐了,返回首页