コード例 #1
0
ファイル: AdHoc.cs プロジェクト: cclark440/FishConWin
        private void btnPrint_Click(object sender, EventArgs e)
        {
            String sPrintString = "";
            int    iCounter     = 0;
            int    iXPos        = 290; //used to calculate x position for centering of item name

            iXPos = iXPos - (tbPartNum.Text.Length / 2) * 22;

            if (rbtnLarge.Checked)
            {
                while (iCounter < tbQty.Value)
                {
                    sPrintString += "^XA^A@N,25,25,E:ARI001.FNT^FO70,30^A@N,26,31^FDQ-Mark Manufacturing, Inc.^FS^FO207,60^A@N,20,20^FDwww.cmms.com^FS";
                    sPrintString += "^FO195,220^A@N,30,30^FDMade in USA^FS^A@N,25,25,E:ARI001.FNT^FO" + iXPos + ",135^A@N,35,35^FD" + tbPartNum.Text;
                    sPrintString += "^FS\r\n^XZ\r\n";
                    iCounter     += 1;
                }

                RawPrintHelper.SendStringToPrinter(_form1.PD.PrinterSettings.PrinterName, "^XA~SD15^XZ", "FishConWn LL AdHoc"); // SETS DARKNESS of print.
                RawPrintHelper.SendStringToPrinter(_form1.PD.PrinterSettings.PrinterName, sPrintString, "FishConWn LL AdHoc");
            }
            else if (rbtnSmall.Checked)
            {
                while (iCounter < tbQty.Value)
                {
                    sPrintString += "^XA^A@N,25,25,E:ARI002.FNT^FO83," + 12 + FishConVars.SmallVertOffset + "^A@N,26,31^FDQ-Mark Manufacturing, Inc.^FS^FO100," + 95 + FishConVars.SmallVertOffset + "^A@N,20,20^FDwww.cmms.com^FS";
                    sPrintString += "^FO340," + 95 + FishConVars.SmallVertOffset + "^A@N,20,20^FDMade in USA^FS^A@N,25,25,E:ARI002.FNT^FO" + iXPos + "," + 50 + FishConVars.SmallVertOffset + "^A@N,35,35^FD" + tbPartNum.Text; // iItem.Text
                    sPrintString += "^FS\r\n^XZ\r\n";
                    iCounter     += 1;
                }

                RawPrintHelper.SendStringToPrinter(_form1.PD2.PrinterSettings.PrinterName, "^XA~SD15^XZ", "FishConWn SS AdHoc");// ' SETS DARKNESS of print.
                RawPrintHelper.SendStringToPrinter(_form1.PD2.PrinterSettings.PrinterName, sPrintString, "FishConWn SS AdHoc");
            }
            else
            {
                MessageBox.Show("Please choose a printer before continuing.", "No Printer Sleceted", MessageBoxButtons.OK);
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: cclark440/FishConWin
        //-----------Print Labels----------------------
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (!CheckPrinter())
            {
                MessageBox.Show("Printer must be selected before labels can be printed", "No Printer Selected");
                return;
            }
            else
            {
                if (dataGridView1.Rows.Count > 0)
                {//build labels
                    String sLargeLabels = "";
                    String sSmallLabels = "";
                    String sLabels      = "";
                    int    iLength      = 0;


                    for (int r = 0; r < dataGridView1.Rows.Count; r++)
                    {
                        if (Convert.ToBoolean(dataGridView1.Rows[r].Cells[0].Value) == false) //Check if we are skipping item.
                        {                                                                     //*********  Large Labels ******************
                            sLabels = "";
                            int    iXPos = 290;
                            String sItem = dataGridView1.Rows[r].Cells[1].Value.ToString();
                            iXPos = iXPos - (sItem.Length / 2) * 22;

                            if (dataGridView1.Rows[r].Cells[3].Value.ToString() == "" || dataGridView1.Rows[r].Cells[3].Value.ToString() == "Large")
                            {
                                sLabels += "^XA^A@N,25,25,E:ARI001.FNT^FO70,30^A@N,26,31^FDQ-Mark Manufacturing, Inc.^FS^FO207,60^A@N,20,20^FDwww.cmms.com^FS";
                                sLabels += "^FO195,220^A@N,30,30^FDMade in USA^FS^A@N,25,25,E:ARI001.FNT^FO" + iXPos + ",135^A@N,35,35^FD" + sItem;// 'iItem.Text
                                sLabels += "^FS^FO10,75^AOR,15,15^FD" + tbSalesOrder.Text;
                                sLabels += "^FS\r\n^XZ\r\n";

                                double iLabelCount = Convert.ToDouble(dataGridView1.Rows[r].Cells[2].Value);
                                for (int l = 0; l < iLabelCount; l++)
                                {
                                    sLargeLabels += sLabels;
                                }
                            }
                            //**************   Samll Labels  ********************
                            if (dataGridView1.Rows[r].Cells[3].Value.ToString() == "Small")
                            {
                                sLabels += "^XA^A@N,25,25,E:ARI002.FNT^FO83," + 12 + FishConVars.SmallVertOffset + "^A@N,26,31^FDQ-Mark Manufacturing, Inc.^FS^FO100," + 95 + FishConVars.SmallVertOffset + "^A@N,20,20^FDwww.cmms.com^FS";
                                sLabels += "^FO340," + 95 + FishConVars.SmallVertOffset + "^A@N,20,20^FDMade in USA^FS^A@N,25,25,E:ARI002.FNT^FO" + iXPos + "," + 50 + FishConVars.SmallVertOffset + "^A@N,35,35^FD" + sItem; //iItem.Text
                                sLabels += "^FS^FO10,10^AOR,10,10^FD" + tbSalesOrder.Text;
                                sLabels += "^FS\r\n^XZ\r\n";

                                for (int l = 0; l < Convert.ToDouble(dataGridView1.Rows[r].Cells[2].Value.ToString()); l++)
                                {
                                    sSmallLabels += sLabels;
                                }
                            }
                        }
                    }
                    if (sLargeLabels != "")
                    {
                        //FishConVars.sLog += sLargeLabels;
                        sLargeLabels += "^XA^A@N,25,25,E:ARI001.FNT^FO250,135^A@N,35,35^FD" + tbSalesOrder.Text + "^FS^FO25,50^A@N,25,25^FD" + lblCustomer.Text + "^ FS^XZ";
                        RawPrintHelper.SendStringToPrinter(PD.PrinterSettings.PrinterName, "^XA~SD15^XZ", "FishConWn LL AdHoc"); // SETS DARKNESS of print.
                        RawPrintHelper.SendStringToPrinter(PD.PrinterSettings.PrinterName, sLargeLabels, "FishConWn LL AdHoc");
                    }
                    if (sSmallLabels != "")
                    {
                        //FishConVars.sLog += sSmallLabels;
                        sSmallLabels += "^XA^A@N,25,25,E:ARI002.FNT^FO450,50^A@N,25,25^FD" + tbSalesOrder.Text + "^FS^FO20,50^A@N,25,25^FD" + lblCustomer.Text + "^FS^XZ";
                        RawPrintHelper.SendStringToPrinter(PD2.PrinterSettings.PrinterName, "^XA~SD15^XZ", "FishConWn LL AdHoc"); // SETS DARKNESS of print.
                        RawPrintHelper.SendStringToPrinter(PD2.PrinterSettings.PrinterName, sSmallLabels, "FishConWn LL AdHoc");
                    }
                }
            }
        }