示例#1
0
        /// <summary>
        /// 绑定打印机
        /// </summary>
        void BindPrinter()
        {
            // 加载系统默认打印机信息到系统中
            var list = PrinterHelper.GetLocalPrinters();

            lsbPrinter.Items.AddRange(list.ToArray());
        }
示例#2
0
        /// <summary>
        /// 窗体加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmPrinterSetting_Load(object sender, EventArgs e)
        {
            // 加载系统默认打印机信息到系统中
            var list = PrinterHelper.GetLocalPrinters();

            gcPrinter.DataSource = list;
            gvPrinter.Columns["Column"].Width = 22;
            gvPrinter.Columns["Column"].OptionsColumn.ShowCaption = false;
            gvPrinter.Columns["Column"].OptionsColumn.AllowSort   = DefaultBoolean.False;
            var defaultPrinter = BillPrintHelper.GetDefaultPrinter();

            if (!string.IsNullOrEmpty(defaultPrinter))
            {
                lblDefaultPrinter.Text = @"默认打印机:" + defaultPrinter;
            }
        }