Ejemplo n.º 1
0
 private void SetDefaultPrinter_Load(object sender, EventArgs e)
 {
     listBox1.Dock = DockStyle.Fill;
     foreach (String fPrinterName in LocalPrinter.GetLocalPrinters())
     {
         listBox1.Items.Add(fPrinterName);
     }
     this.Controls.Add(listBox1);
 }
Ejemplo n.º 2
0
        public Printer()
        {
            InitializeComponent();

            //listBox1.Dock = DockStyle.Fill;
            foreach (String fPrinterName in LocalPrinter.GetLocalPrinters())
            {
                listBox1.Items.Add(fPrinterName);
            }
            this.Controls.Add(listBox1);
        }
Ejemplo n.º 3
0
        private void init()
        {
            windowsMin = new WindowsMin(this);// 设置最小化到任务栏
            PrintService pt = new PrintService();

            //配置socket服务
            mySocketServer = new MySocketService(pt);
            socketBase     = new SocketBase(mySocketServer);
            socketBase.start();
            //获取打印机信息
            var printers = LocalPrinter.GetLocalPrinters();

            PrintList.ItemsSource   = printers;
            PrintList.SelectedIndex = 0;
            MyLogService.Info("打印服务已启动");
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 窗体初始化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void printSet_load(object sender, EventArgs e)
        {
            //从字典表中取得打印机类型列表
            DBAccess  dBAccess    = new DBAccess();
            DataTable dtPrintList = TJClient.Common.Common.getsjzd("printFileType", "sql_select_sjzd");

            if (dtPrintList != null && dtPrintList.Rows.Count > 0)
            {
                comboBox_printType.DataSource    = dtPrintList;
                comboBox_printType.DisplayMember = "ZDMC";
                comboBox_printType.ValueMember   = "ZDBM";
            }



            //已设定的打印机
            XmlRW  xmlWrite   = new XmlRW();
            string printName  = xmlWrite.GetValueFormXML("UserConfig.xml", comboBox_printType.SelectedValue.ToString());
            string print_view = xmlWrite.GetValueFormXML("UserConfig.xml", comboBox_printType.SelectedValue.ToString() + "_view");

            if (print_view.ToLower().Equals("true"))
            {
                checkBox_view.Checked = true;
            }
            else
            {
                checkBox_view.Checked = false;
            }

            //获得系统中的打印机列表
            List <String> list = LocalPrinter.GetLocalPrinters();

            foreach (String s in list)
            {
                //将打印机名称添加到下拉框中
                comboBox_sysPrint.Items.Add(s);
                if (s.Equals(printName))
                {
                    comboBox_sysPrint.Text = printName;
                }
            }

            comboBox_printType.Focus();
        }
Ejemplo n.º 5
0
        private void printconfig_Load(object sender, EventArgs e)
        {
            #region 取得当前电脑可用的所有打印机
            listBox1.Dock = DockStyle.Fill;
            foreach (String fPrinterName in LocalPrinter.GetLocalPrinters())
            {
                listBox1.Items.Add(fPrinterName);
            }
            #endregion

            #region 注释代码
            //dataGridView1.RowHeadersVisible = false;
            //dataGridView1.ColumnHeadersVisible = false;
            ////dataGridView1.ReadOnly = true;
            //DataGridViewTextBoxColumn acCode = new DataGridViewTextBoxColumn();
            ////acCode.Name = "拣货单";
            ////acCode.DataPropertyName = "拣货单";
            ////acCode.HeaderText = "A/C Code";
            //dataGridView1.Columns.Add(acCode);
            //DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn();
            //col.Items.Add("模式一");
            //col.Items.Add("模式二");
            //col.Name="模式";
            //dataGridView1.Columns.Add(col);
            //dataGridView1.Columns["模式"].ReadOnly=true;
            //col.Selected = true;
            //DataGridViewCheckBoxColumn check = new DataGridViewCheckBoxColumn();
            //dataGridView1.Columns.Add(check);

            //dataGridView1.Rows.Add("拣货单");
            //dataGridView1.Rows.Add("Yamato");
            //dataGridView1.Rows.Add("ECOHAI");
            //dataGridView1.Rows.Add("Umail");
            //dataGridView1.Rows.Add("包裹号");
            //dataGridView1.Rows.Add("SKU");
            #endregion
            int iRowIndex = 0;
            this.dataGridView1.Rows.AddCopy(iRowIndex);
            this.dataGridView1["ID", iRowIndex].Value    = "1";
            this.dataGridView1["page", iRowIndex].Value  = "拣货单";
            this.dataGridView1["model", iRowIndex].Value = "模式一";
            this.dataGridView1["IsUse", iRowIndex].Value = 0;
            iRowIndex = 1;
            this.dataGridView1.Rows.AddCopy(iRowIndex);
            this.dataGridView1["ID", iRowIndex].Value    = "2";
            this.dataGridView1["page", iRowIndex].Value  = "Yamato";
            this.dataGridView1["model", iRowIndex].Value = "模式一";
            this.dataGridView1["IsUse", iRowIndex].Value = 0;
            iRowIndex = 2;
            this.dataGridView1.Rows.AddCopy(iRowIndex);
            this.dataGridView1["ID", iRowIndex].Value    = "3";
            this.dataGridView1["page", iRowIndex].Value  = "ECOHAI";
            this.dataGridView1["model", iRowIndex].Value = "模式一";
            this.dataGridView1["IsUse", iRowIndex].Value = 0;
            iRowIndex = 3;
            this.dataGridView1.Rows.AddCopy(iRowIndex);
            this.dataGridView1["ID", iRowIndex].Value    = "4";
            this.dataGridView1["page", iRowIndex].Value  = "Umail";
            this.dataGridView1["model", iRowIndex].Value = "模式一";
            this.dataGridView1["IsUse", iRowIndex].Value = 0;
            iRowIndex = 4;
            this.dataGridView1.Rows.AddCopy(iRowIndex);
            this.dataGridView1["ID", iRowIndex].Value    = "5";
            this.dataGridView1["page", iRowIndex].Value  = "包裹号";
            this.dataGridView1["model", iRowIndex].Value = "模式一";
            this.dataGridView1["IsUse", iRowIndex].Value = 0;
            iRowIndex = 5;
            this.dataGridView1.Rows.AddCopy(iRowIndex);
            this.dataGridView1["ID", iRowIndex].Value    = "6";
            this.dataGridView1["page", iRowIndex].Value  = "SKU";
            this.dataGridView1["model", iRowIndex].Value = "模式一";
            this.dataGridView1["IsUse", iRowIndex].Value = 0;

            iRowIndex = 6;
            this.dataGridView1.Rows.AddCopy(iRowIndex);
            this.dataGridView1["ID", iRowIndex].Value    = "7";
            this.dataGridView1["page", iRowIndex].Value  = "转运单";
            this.dataGridView1["model", iRowIndex].Value = "模式一";
            this.dataGridView1["IsUse", iRowIndex].Value = 0;

            iRowIndex = 7;
            this.dataGridView1.Rows.AddCopy(iRowIndex);
            this.dataGridView1["ID", iRowIndex].Value    = "8";
            this.dataGridView1["page", iRowIndex].Value  = "Upacket";
            this.dataGridView1["model", iRowIndex].Value = "模式一";
            this.dataGridView1["IsUse", iRowIndex].Value = 0;

            //显示已配置的面单
            //1.先判断XML文件是否存在,如果不存在则创建一个
            dataGridView2.ReadOnly = true;

            NewXmlControl xmlfile = new NewXmlControl(Comm.StartupPath + "//config//config.xml", false, "PrintList");
            dataGridView2.DataSource = xmlfile.ReadXMLfile();
        }