示例#1
0
        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string text = textBox1.Text;

                TSCLIB_DLL.openport(printer);
                TSCLIB_DLL.sendcommand("SIZE 45 mm, 15 mm");
                TSCLIB_DLL.sendcommand("SPEED 4");
                TSCLIB_DLL.sendcommand("GAP 3 mm,0 mm");
                if (label_style == "Ribonlı yazdırım")
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON ON");
                }
                else
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                }
                TSCLIB_DLL.sendcommand("DENSITY 8");
                TSCLIB_DLL.sendcommand("DIRECTION 1");
                TSCLIB_DLL.sendcommand("SET TEAR ON");
                TSCLIB_DLL.clearbuffer();



                TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");
                TSCLIB_DLL.windowsfont(16, 34, 40, 0, 3, 0, "Century Gothic", CenterString(text, 22));



                TSCLIB_DLL.printlabel("1", numericUpDown1.Value.ToString());
                TSCLIB_DLL.closeport();
                this.Close();
            }
        }
示例#2
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            /*打印标贴的程序如下*/

            string PhoneName = "hello world";

            //打开打印端口
            TSCLIB_DLL.openport("Deli DL-888F(NEW)");
            //设计打印纸的大小与间距
            TSCLIB_DLL.setup("30", "20", "3", "10", "0", "2", "0");    //宽度、高度、速度寸/秒、浓度0-15、。 长度30 20 OK,倒数间距2 OK
            //清空下缓存
            TSCLIB_DLL.clearbuffer();
            //打印文字
            TSCLIB_DLL.windowsfont(1, 15, 23, 0, 2, 0, "標楷體", PhoneName);  //用windowsTTF字型列印文字 X、Y、字体高度、角度、字体外形、有无底线、字体名称、打印内容
            TSCLIB_DLL.windowsfont(1, 40, 23, 0, 2, 0, "標楷體", PhoneName);  //用windowsTTF字型列印文字 X、Y、字体高度、角度、字体外形、有无底线、字体名称、打印内容
            TSCLIB_DLL.windowsfont(1, 65, 23, 0, 2, 0, "標楷體", PhoneName);  //用windowsTTF字型列印文字 X、Y、字体高度、角度、字体外形、有无底线、字体名称、打印内容
            TSCLIB_DLL.windowsfont(1, 90, 22, 0, 2, 0, "標楷體", PhoneName);  //用windowsTTF字型列印文字 X、Y、字体高度、角度、字体外形、有无底线、字体名称、打印内容
            TSCLIB_DLL.windowsfont(1, 115, 23, 0, 2, 0, "標楷體", PhoneName); //用windowsTTF字型列印文字 X、Y、字体高度、角度、字体外形、有无底线、字体名称、打印内容
            TSCLIB_DLL.windowsfont(1, 138, 23, 0, 2, 0, "標楷體", PhoneName); //用windowsTTF字型列印文字 X、Y、字体高度、角度、字体外形、有无底线、字体名称、打印内容


            //打印份数
            TSCLIB_DLL.printlabel("1", "1");
            //关闭打印端口
            TSCLIB_DLL.closeport();
            MessageBox.Show("hello");
        }
示例#3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('Hello TSCLIB.DLL')", true);
            //TSCLIB_DLL.about();                                                                 //Show the DLL version
            TSCLIB_DLL.openport("TSC TTP-243 Plus");                                           //Open specified printer driver
            TSCLIB_DLL.setup("52", "28.5", "4", "5", "0", "0", "0");

            /*
             * width    設定標籤寬度   單位mm
             * height   設定標籤高度   單位mm
             * speed    設定列印速度   單位sec 間距1~10
             * density  設定列印濃度   單位    間距0~15
             * sensor   設定使用感應器類別 0 表示使用垂直間距感測器(gap sensor) 1 表示使用黑標感測器(black mark sensor)
             * vertical 字串型別,設定gap/black mark 垂直間距高度,單位:mm
             * offset   字串型別,設定gap/black mark 偏移距離,單位: mm,此參數若使用一般標籤時設為0
             */
            TSCLIB_DLL.clearbuffer();                                                           //Clear image buffer
            TSCLIB_DLL.barcode("80", "60", "128", "90", "1", "0", "4", "4", "3680302001393");

            /*
             * x        字串型別,條碼X方向起始點,以點(point)表示。
             * y        字串型別,條碼Y方向起始點,以點(point)表示。
             * type     字串型別
             * height   字串型別,設定條碼高度,高度以點來表示。
             * readable 字串型別,設定是否列印條碼碼文 0: 不列印碼文 1: 列印碼文
             * rotation 字串型別,設定條碼旋轉角度
             * narrow   字串型別,設定條碼窄bar 比例因子,請參考TSPL使用手冊(也會調整條滿寬度)
             * wide     字串型別,設定條碼寬bar 比例因子,請參考TSPL使用手冊(也會調整條滿寬度)
             * code     要列印的條碼
             */
            TSCLIB_DLL.printerfont("100", "200", "4", "0", "1", "2", "Bg04-11");

            /*
             * x:        字串型別,文字X方向起始點,以點(point)表示。
             * y:        字串型別,文字Y方向起始點,以點(point)表示。
             * fonttype: 字串型別,內建字型名稱,共12種。1~5
             * rotaiton: 字串型別,設定文字旋轉角度
             * xmul:     字串型別,設定文字X方向放大倍率,1~8
             * ymul:     字串型別,設定文字y方向放大倍率,1~8
             * text:     字串型別,列印文字內容
             *
             */
            TSCLIB_DLL.windowsfont(50, 270, 30, 0, 0, 0, "標楷體", "MPU-6050三軸加速度傳感器-送排針");

            /*
             * x:        整數型別,文字X方向起始點,以點(point)表示。
             * y:        整數型別,文字y方向起始點,以點(point)表示。
             * fonthigrt:整數型別,字體高度,以點(point)表示。
             * rotation :整數型別,旋轉角度,逆時鐘方向旋轉
             * fontstyle:整數型別,字體外形 0-> 標準(Normal)1-> 斜體(Italic)2-> 粗體(Bold)3-> 粗斜體(Bold and Italic)
             * fontline :整數型別,底線0-> 無底線1-> 加底線
             * szface   :字串型別,字體名稱。如: Arial, Times new Roman, 細名體, 標楷體
             * content  :字串型別,列印文字內容。
             */
            //TSCLIB_DLL.downloadpcx("C:\\ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\UL.PCX", "UL.PCX");                                         //Download PCX file into printer
            //TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
            //TSCLIB_DLL.sendcommand("PUTPCX 100,400,\"UL.PCX\"");                                //Drawing PCX graphic
            TSCLIB_DLL.printlabel("1", "1");                                                    //set: 字串型別,設定列印標籤式數(set)copy: 字串型別,設定列印標籤份數(copy)
            TSCLIB_DLL.closeport();
        }
示例#4
0
        private void price4030(string price, string price_cur, string item_code, string item_name, string label_count, int point_number, int ribon, string item_unit)
        {
            try
            {
                string point_number_s = "";

                TSCLIB_DLL.openport(printer);
                TSCLIB_DLL.sendcommand("SIZE 40 mm, 30 mm");
                TSCLIB_DLL.sendcommand("SPEED 4");
                TSCLIB_DLL.sendcommand("GAP 4.2 mm,0 mm");
                if (ribon == 1)
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON ON");
                }
                else
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                }
                TSCLIB_DLL.sendcommand("DENSITY 8");
                TSCLIB_DLL.sendcommand("DIRECTION 1");
                TSCLIB_DLL.sendcommand("SET TEAR ON");
                TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");

                if (point_number > 0)
                {
                    point_number_s = ".";
                    for (int j = 0; j < point_number; j++)
                    {
                        point_number_s += "0";
                    }
                }
                price = String.Format("{0:### ### ### ##0" + point_number_s + "}", float.Parse(price));
                TSCLIB_DLL.clearbuffer();

                TSCLIB_DLL.windowsfont(16, 0, 100, 0, 2, 0, "Agency FB", CenterString(price, 10));
                TSCLIB_DLL.windowsfont(230, 81, 35, 0, 1, 0, "Century Gothic", price_cur);

                TSCLIB_DLL.windowsfont(16, 118, 26, 0, 2, 0, "Century Gothic", CenterString(item_code, 30));
                if (item_name.Length > 28)
                {
                    TSCLIB_DLL.windowsfont(16, 145, 20, 0, 2, 0, "Century Gothic", item_name.Substring(0, 26) + "-");
                    TSCLIB_DLL.windowsfont(16, 162, 20, 0, 2, 0, "Century Gothic", item_name.Substring(26, item_name.Length - 26));
                }
                else
                {
                    TSCLIB_DLL.windowsfont(8, 149, 20, 0, 2, 0, "Century Gothic", CenterString(item_name, 32));
                }

                TSCLIB_DLL.windowsfont(235, 175, 20, 0, 3, 0, "Century Gothic", item_unit);

                TSCLIB_DLL.printlabel("1", label_count);

                TSCLIB_DLL.closeport();
            }

            catch (Exception e)
            {
                Log.set("HATA: PriceForm>4030 print()\nEXCEPTION:" + e.ToString());
            }
        }
示例#5
0
        private void btn_Box_Click(object sender, EventArgs e)//bar测试
        {
            TSCLIB_DLL.openport("TSC TDP-245");

            TSCLIB_DLL.sendcommand("CLS");
            TSCLIB_DLL.sendcommand("SIZE 80 mm,50 mm");
            TSCLIB_DLL.sendcommand("BAR 24,0,0,400");
            TSCLIB_DLL.sendcommand("BAR 30,0,3,400");
            TSCLIB_DLL.sendcommand("BAR 42,0,6,400");
            TSCLIB_DLL.sendcommand("BAR 60,0,9,400");
            TSCLIB_DLL.sendcommand("BAR 80,0,12,400");
            TSCLIB_DLL.sendcommand("BAR 114,0,15,400");
            TSCLIB_DLL.sendcommand("BAR 150,0,18,400");
            TSCLIB_DLL.sendcommand("BAR 192,0,21,400");
            TSCLIB_DLL.sendcommand("BAR 240,0,24,400");
            TSCLIB_DLL.sendcommand("BAR 294,0,27,400");
            TSCLIB_DLL.sendcommand("BAR 354,0,30,400");
            TSCLIB_DLL.sendcommand("BAR 420,0,33,400");
            TSCLIB_DLL.sendcommand("BAR 24,0,400,0");
            TSCLIB_DLL.sendcommand("BAR 24,6,400,3");
            TSCLIB_DLL.sendcommand("BAR 24,18,400,6");
            TSCLIB_DLL.sendcommand("BAR 24,36,400,9");
            TSCLIB_DLL.sendcommand("BAR 24,60,400,12");
            TSCLIB_DLL.sendcommand("BAR 24,90,400,15");
            TSCLIB_DLL.sendcommand("BAR 24,126,400,18");
            TSCLIB_DLL.sendcommand("BAR 24,168,400,21");
            TSCLIB_DLL.sendcommand("BAR 24,216,400,24");
            TSCLIB_DLL.sendcommand("BAR 24,270,400,27");
            TSCLIB_DLL.sendcommand("BAR 24,330,400,30");
            TSCLIB_DLL.sendcommand("BAR 24,396,400,33");

            TSCLIB_DLL.sendcommand("PRINT 1");

            TSCLIB_DLL.closeport();
        }
示例#6
0
        private static void DataReceivedHandler(
            object sender,
            SerialDataReceivedEventArgs e)
        {
            SerialPort sp     = (SerialPort)sender;
            string     indata = sp.ReadExisting();

            // If received "Detected!" from arduino Port
            if (indata.Contains("D"))
            {
                //MessageBox.Show("Is Dot Net Perls awesome?", "Important Question", MessageBoxButtons.YesNo);
                // Setup printer to print something
                TSCLIB_DLL.openport("TSC TDP-225");                                           //Open specified printer driver
                TSCLIB_DLL.setup("25", "220", "1", "8", "1", "6", "0");                       //Setup the media size and sensor type info
                TSCLIB_DLL.clearbuffer();                                                     //Clear image buffer
                //TSCLIB_DLL.barcode("100", "100", "128", "100", "1", "270", "2", "2", "Barcode Test"); //Drawing barcode
                //TSCLIB_DLL.printerfont("100", "250", "3", "0", "1", "1", "Print Font Test");        //Drawing printer font
                //TSCLIB_DLL.windowsfont(100, 300, 24, 270, 0, 0, "ARIAL", "Windows Arial Font Test");  //Draw windows font
                //TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
                TSCLIB_DLL.sendcommand("QRCODE 30,30,M,6,0,M2,\"BRADY123\"");
                //TSCLIB_DLL.sendcommand("PUTPCX 100,400,\"UL.PCX\"");
                //Drawing PCX graphic
                TSCLIB_DLL.printlabel("1", "1");                                                    //Print labels
                TSCLIB_DLL.closeport();
            }
        }
示例#7
0
        private void btnSendBTCommand_Click(object sender, EventArgs e)
        {
            try
            {
                Alert(TSCLIB_DLL.openport(EnumDeviceNames.MUBLabelPrinter).ToString());
                TSCLIB_DLL.clearbuffer();
                List <string> cmdLines = new List <string>();
                for (int i = 0; i < rtbBarTenderCommand.Lines.Length; i++)
                {
                    cmdLines.Add(rtbBarTenderCommand.Lines[i]);
                    Alert(TSCLIB_DLL.sendcommand(rtbBarTenderCommand.Lines[i]).ToString());
                }

                //int result = TSCLIB_DLL.openport(EnumDeviceNames.MUBLabelPrinter);
                ////TSCLIB_DLL.clearbuffer();

                //result = TSCLIB_DLL.sendcommand("DMATRIX 120,8,400,400");
                //TSCLIB_DLL.printlabel("1", "1");

                TSCLIB_DLL.closeport();
            }
            catch (Exception ex)
            {
                Alert(ex.ToString());
            }
        }
示例#8
0
        // Function to perform printing module!
        private void PrintDemoLabel(bool reprint)
        {
            // Read from DB to get counter. return 1 if db not found.
            // append the string with time,gate and counter
            // write time, gate, count and reprint to DB.
            // Print out ticket accordingly.
            // Update the label for counter.
            // if reprtint, do not increment the counter.
            String printformat = UpdateDB(reprint);

            // Update the counter at here
            LABEL_COUNT.Invoke(new EventHandler(delegate
            {
                LABEL_COUNT.Text = printformat.Split('/').Last();
            }));
            String gatePrint  = "Gate: " + printformat.Split('/')[1];
            String CountPrint = "Counter: " + printformat.Split('/').Last();

            TSCLIB_DLL.openport("TSC TDP-225");                                                 //Open specified printer driver
            TSCLIB_DLL.setup("40", "450", "12", "8", "1", "6", "300");                          //Setup the media size and sensor type info
            TSCLIB_DLL.clearbuffer();                                                           //Clear image buffer
            TSCLIB_DLL.barcode("100", "470", "128", "100", "0", "270", "2", "2", printformat);  //Drawing barcode
            TSCLIB_DLL.printerfont("140", "480", "5", "90", "1", "1", gatePrint);               //Print Gate number
            TSCLIB_DLL.printerfont("210", "480", "5", "90", "1", "1", CountPrint);              //Print Ticket Counter
            TSCLIB_DLL.sendcommand($"QRCODE 80,0,M,7,M,0,M2,S1,\"A{printformat}\"");            //Draw QR Code
            TSCLIB_DLL.printlabel("1", "1");                                                    //Print labels
            TSCLIB_DLL.closeport();                                                             //Close specified printer driver
        }
示例#9
0
        private void BtnPrnSticker_Click(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            string WT1 = txtName.Text.Trim();
            string B1  = txtBarcode.Text.Trim();

            byte[] result_unicode = System.Text.Encoding.GetEncoding("utf-16").GetBytes("unicode test");
            byte[] result_utf8    = System.Text.Encoding.UTF8.GetBytes("TEXT 40,620,\"ARIAL.TTF\",0,12,12,\"utf8 test Wörter auf Deutsch\"");

            //TSCLIB_DLL.about();
            byte status = TSCLIB_DLL.usbportqueryprinter();     //0 = idle, 1 = head open, 16 = pause, following <ESC>!? command of TSPL manual

            TSCLIB_DLL.openport("TSC TE210");
            TSCLIB_DLL.sendcommand("SIZE 100 mm, 120 mm");
            TSCLIB_DLL.sendcommand("SPEED 4");
            TSCLIB_DLL.sendcommand("DENSITY 12");
            TSCLIB_DLL.sendcommand("DIRECTION 1");
            TSCLIB_DLL.sendcommand("SET TEAR ON");
            TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");
            TSCLIB_DLL.clearbuffer();
            //TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");
            TSCLIB_DLL.windowsfont(40, 490, 48, 0, 0, 0, "Arial", "Windows Font Test");
            TSCLIB_DLL.windowsfontUnicode(40, 550, 48, 0, 0, 0, "Arial", result_unicode);
            //TSCLIB_DLL.sendcommand("PUTPCX 40,40,\"UL.PCX\"");
            TSCLIB_DLL.sendBinaryData(result_utf8, result_utf8.Length);
            TSCLIB_DLL.barcode("40", "300", "128", "80", "1", "0", "2", "2", B1);
            TSCLIB_DLL.printerfont("40", "250", "0", "0", "15", "15", WT1);
            TSCLIB_DLL.printlabel("1", "1");
            TSCLIB_DLL.closeport();
        }
示例#10
0
 private void button2_Click(object sender, EventArgs e)//LF
 {
     TSCLIB_DLL.openport("TSC TDP-245");
     //TSCLIB_DLL.setup("100", "63.5", "4", "8", "0", "0", "0");
     //TSCLIB_DLL.clearbuffer();
     //TSCLIB_DLL.formfeed();
     TSCLIB_DLL.sendcommand("FEED 400");
     TSCLIB_DLL.closeport();
 }
        public void Print(ExportDetail itm)
        {
            if (Export.SourceTransaction != "Sales Order")
            {
                return;
            }
            try
            {
                for (int i = 0; i < Quantity; i++)
                {
                    const int    VerticalSpace   = 150;
                    const int    HorizontalSpace = 100;
                    const string LabelFontSize   = "2.5";

                    TSCLIB_DLL.openport(Settings.Default.TSCPrinter);                                  //Open specified printer driver
                    TSCLIB_DLL.setup("101", "150", "6", "8", "0", "5", "0");                           //Setup the media size and sensor type info
                    TSCLIB_DLL.clearbuffer();                                                          //Clear image buffer
                    TSCLIB_DLL.downloadpcx("box.pcx", "box.pcx");                                      //Download PCX file into printer

                    TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * .5).ToString(), "3", "0", "4", "4", "M.N.I.B.");
                    TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 1.25).ToString(), "3", "0", "1.75", "1.75", "Young Street, St. George's, Grenada");

                    TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 2.5).ToString(), "3", "0", LabelFontSize, LabelFontSize, Instance.Info.Substring(0, Instance.Info.IndexOf(" - ")));
                    TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 3).ToString(), "3", "0", "1.75", "1.75", Instance.Info.Substring(Instance.Info.IndexOf(" - ") + 1));


                    TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 4).ToString(), "3", "0", "2", "2", DateTime.Today.ToString("yyyy-MMM-dd"));        //Drawing printer font


                    TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 4.5).ToString(), "3", "0", LabelFontSize, LabelFontSize, itm.Barcode);


                    TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 5).ToString(), "3", "0", LabelFontSize, LabelFontSize, Export.ProductDescription);

                    TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 5.75).ToString(), "3", "0", "2", "2", Box.Description);

                    TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 6.5).ToString(), "3", "0", "2", "2", itm.Weight.ToString());
                    TSCLIB_DLL.printerfont((HorizontalSpace * 1.5).ToString(), (VerticalSpace * 6.5).ToString(), "3", "0", "2", "2", "LBS.");

                    TSCLIB_DLL.barcode((HorizontalSpace * .5).ToString(), (VerticalSpace * 7).ToString(), "128", "125", "1", "0", "8", "8", itm.Barcode); //Drawing barcode



                    TSCLIB_DLL.printlabel("1", "1");                                                    //Print labels
                    TSCLIB_DLL.closeport();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public void PrintText(string zXPos, string zYPos, string zFontHeight, string zRotation, string zFontStyle,
                              string zUnderLine, string zFont, string zTextToPrint)
        {
            int labelNo = 0;

            while (labelNo < Convert.ToInt16(_labelsPerLine))
            {
                TSCLIB_DLL.windowsfont(Convert.ToInt16(zXPos) + (labelNo * Convert.ToInt16(_zNextPos)), Convert.ToInt16(zYPos),
                                       Convert.ToInt16(zFontHeight), Convert.ToInt16(zRotation), Convert.ToInt16(zFontStyle),
                                       Convert.ToInt16(zUnderLine), zFont, zTextToPrint);
                labelNo++;
            }
        }
示例#13
0
 private void btn_print_Click(object sender, EventArgs e)
 {
     TSCLIB_DLL.openport("TSC TDP-225");                                               //Open specified printer driver
     TSCLIB_DLL.setup("25", "220", "1", "8", "1", "6", "0");                           //Setup the media size and sensor type info
     TSCLIB_DLL.clearbuffer();                                                         //Clear image buffer
     //TSCLIB_DLL.barcode("150", "600", "128", "100", "1", "270", "2", "2", "Barcode Test"); //Drawing barcode
     //TSCLIB_DLL.printerfont("100", "350", "3", "270", "1", "1", "Print Font Test");        //Drawing printer font
     //TSCLIB_DLL.windowsfont(100, 400, 24, 90, 0, 0, "ARIAL", "Windows Arial Font Test");  //Draw windows font
     //TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
     TSCLIB_DLL.sendcommand("QRCODE 30,30,M,6,0,M2,\"BRADY123\"");                //Drawing PCX graphic
     TSCLIB_DLL.printlabel("1", "1");                                             //Print labels
     TSCLIB_DLL.closeport();                                                      //Close specified printer driver
 }
示例#14
0
        private void Print(InstrumentModel m, Constants.BarCodeLayout layout)
        {
            // 打开 打印机 端口.
            try
            {
                if (string.IsNullOrEmpty(comboBox1.SelectedItem.ToString()))
                {
                    MessageBox.Show("请选择打印机。");
                    return;
                }
                TSCLIB_DLL.openport(comboBox1.SelectedItem.ToString());                                                //Open
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0}打印机安装出错或没有安装驱动。", comboBox1.SelectedItem.ToString()));
                return;
            }
            switch (layout)
            {
            case Constants.BarCodeLayout.二维码左:
                QRCode_ABPrint(m);
                break;

            case Constants.BarCodeLayout.二维码右:
                QRCode_BAPrint(m);
                break;

            case Constants.BarCodeLayout.条码上:
                BarCode_ABPrint(m);
                break;

            case Constants.BarCodeLayout.条码下:
                BarCode_BAPrint(m);
                break;

            case Constants.BarCodeLayout.混合条码上:
                MixCode_ABPrint(m);
                break;

            case Constants.BarCodeLayout.混合条码下:
                MixCode_BAPrint(m);
                break;
            }

            //// if (radioButton1.Checked)//二维码
            //     QRCodePrint(m, layout);//二维码
            // //else if (radioButton2.Checked)//条形码
            //     BarCodePrint(m, layout);//条形码
            // //else
            // MixCodePrint(m, layout);//混合
        }
示例#15
0
        //---------- price
        private void price4515(string price, string price_cur, string item_code, string item_name, string label_count, int point_number, int ribon)
        {
            try
            {
                string point_number_s = "";
                string price_with_cur = "";
                TSCLIB_DLL.openport(printer);
                TSCLIB_DLL.sendcommand("SIZE 45 mm, 15 mm");
                TSCLIB_DLL.sendcommand("SPEED 4");
                TSCLIB_DLL.sendcommand("GAP 3 mm,0 mm");
                if (ribon == 1)
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON ON");
                }
                else
                {
                    TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                }
                TSCLIB_DLL.sendcommand("DENSITY 8");
                TSCLIB_DLL.sendcommand("DIRECTION 1");
                TSCLIB_DLL.sendcommand("SET TEAR ON");
                TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");

                if (point_number > 0)
                {
                    point_number_s = ".";
                    for (int j = 0; j < point_number; j++)
                    {
                        point_number_s += "0";
                    }
                }
                price          = String.Format("{0:### ### ### ##0" + point_number_s + "}", float.Parse(price));
                price_with_cur = price + " " + price_cur;
                if (item_name.Length > 30)
                {
                    item_name = item_name.Substring(0, 30) + "...";
                }
                TSCLIB_DLL.clearbuffer();
                TSCLIB_DLL.windowsfont(16, 10, 50, 0, 2, 0, "Century Gothic", CenterString(price_with_cur, 19));
                TSCLIB_DLL.windowsfont(16, 55, 25, 0, 3, 0, "Century Gothic", CenterString(item_code, 37));
                TSCLIB_DLL.windowsfont(16, 80, 18, 0, 3, 0, "Century Gothic", CenterString(item_name, 50));

                TSCLIB_DLL.printlabel("1", label_count);

                TSCLIB_DLL.closeport();
            }
            catch (Exception e)
            {
                Log.set("HATA: PriceForm>4515 print()\nEXCEPTION:" + e.ToString());
            }
        }
 public void SetBcPrinter(string zBcPrinterName, string zPrintSpeed, string zPrintDensity,
                          string zPrintSensorType, string zPrintVerticalGapHeight)
 {
     _zBcPrinterName          = zBcPrinterName;
     _zPrintSpeed             = zPrintSpeed;
     _zPrintDensity           = zPrintDensity;
     _zPrintSensorType        = zPrintSensorType;
     _zPrintVerticalGapHeight = zPrintVerticalGapHeight;
     GlobalVariables.Logger.WriteToInfoLog(string.Format("Opening the printer: Name={0}, Speed={1}, Density={2}, Sensor={3}, Gap={4}",
                                                         zBcPrinterName, zPrintSpeed, zPrintDensity, zPrintSensorType, zPrintVerticalGapHeight));
     TSCLIB_DLL.openport(zBcPrinterName);
     TSCLIB_DLL.setup(_zWidth, _zHeight, zPrintSpeed, zPrintDensity, zPrintSensorType, zPrintVerticalGapHeight, "0");
     TSCLIB_DLL.clearbuffer();
 }
示例#17
0
 private void button1_Click(object sender, EventArgs e)
 {
     //TSCLIB_DLL.about();                                                                 //Show the DLL version
     TSCLIB_DLL.openport("TSC TTP-344M Plus");                                           //Open specified printer driver
     TSCLIB_DLL.setup("100", "63.5", "4", "8", "0", "0", "0");                           //Setup the media size and sensor type info
     TSCLIB_DLL.clearbuffer();                                                           //Clear image buffer
     TSCLIB_DLL.barcode("100", "100", "128", "100", "1", "0", "2", "2", "Barcode Test"); //Drawing barcode
     TSCLIB_DLL.printerfont("100", "250", "3", "0", "1", "1", "Print Font Test");        //Drawing printer font
     TSCLIB_DLL.windowsfont(100, 300, 24, 0, 0, 0, "ARIAL", "Windows Arial Font Test");  //Draw windows font
     TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
     TSCLIB_DLL.sendcommand("PUTPCX 100,400,\"UL.PCX\"");                                //Drawing PCX graphic
     TSCLIB_DLL.printlabel("1", "1");                                                    //Print labels
     TSCLIB_DLL.closeport();                                                             //Close specified printer driver
 }
        private void PrintMediumSizeLabel(PurchaseOrderDetail itm)
        {
            try
            {
                const int    VerticalSpace   = 75;
                const int    HorizontalSpace = 101;
                const string LabelFontSize   = "2.5";

                TSCLIB_DLL.openport(Settings.Default.TSCPrinter);                                   //Open specified printer driver
                TSCLIB_DLL.setup("101", "50.2", "6", "8", "0", "0", "0");                           //Setup the media size and sensor type info
                TSCLIB_DLL.clearbuffer();                                                           //Clear image buffer
                TSCLIB_DLL.downloadpcx("box.pcx", "box.pcx");                                       //Download PCX file into printer



                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * .5).ToString(), "2", "0", LabelFontSize, LabelFontSize, PurchaseOrder.Vendor);

                TSCLIB_DLL.printerfont((HorizontalSpace * 5).ToString(), (VerticalSpace * 1.3).ToString(), "2", "0", LabelFontSize, LabelFontSize, PurchaseOrder.PODate.ToString("yyyy-MMM-dd"));        //Drawing printer font

                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 1.3).ToString(), "3", "0", LabelFontSize, LabelFontSize, "Inv#");
                TSCLIB_DLL.printerfont((HorizontalSpace * 2).ToString(), (VerticalSpace * 1.3).ToString(), "3", "0", LabelFontSize, LabelFontSize, itm.PurchaseOrderNo);

                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 2).ToString(), "3", "0", LabelFontSize, LabelFontSize, "Item:");
                TSCLIB_DLL.printerfont((HorizontalSpace * 2.3).ToString(), (VerticalSpace * 2).ToString(), "3", "0", LabelFontSize, LabelFontSize, itm.ItemDescription);

                TSCLIB_DLL.barcode((HorizontalSpace * .5).ToString(), (VerticalSpace * 3).ToString(), "128", "75", "0", "0", "9", "8", itm.Barcode); //Drawing barcode

                TSCLIB_DLL.printerfont((HorizontalSpace * 2).ToString(), (VerticalSpace * 4.1).ToString(), "2", "0", "5", "5", itm.Barcode);

                //TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 4.5).ToString(), "3", "0", LabelFontSize, LabelFontSize, "SORT");
                //TSCLIB_DLL.sendcommand(string.Format("BOX {0},{1},{2},{3},2,19.2", HorizontalSpace * 0, VerticalSpace * 4.5, HorizontalSpace * 2, VerticalSpace * 4.5 + 50));

                //TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 5.5).ToString(), "3", "0", LabelFontSize, LabelFontSize, "GRADED");
                //TSCLIB_DLL.sendcommand(string.Format("BOX {0},{1},{2},{3},2,19.2", HorizontalSpace * 4, VerticalSpace * 5.5, HorizontalSpace * 8, VerticalSpace * 5.5 + 50));

                //TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 6.5).ToString(), "3", "0", LabelFontSize, LabelFontSize, "WASH");
                //TSCLIB_DLL.sendcommand(string.Format("BOX {0},{1},{2},{3},2,19.2", HorizontalSpace * 4, VerticalSpace * 6.5, HorizontalSpace * 8, VerticalSpace * 6.5 + 50));

                //TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 7.5).ToString(), "3", "0", LabelFontSize, LabelFontSize, "CHILLER#");
                //TSCLIB_DLL.sendcommand(string.Format("BOX {0},{1},{2},{3},2,19.2", HorizontalSpace * 4, VerticalSpace * 7.5, HorizontalSpace * 8, VerticalSpace * 7.5 + 49));


                TSCLIB_DLL.printlabel("1", itm.LabelQty.ToString());                                                    //Print labels
                TSCLIB_DLL.closeport();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#19
0
 private void btn_test_Click(object sender, EventArgs e)//测试按钮
 {
     //TSCLIB_DLL.about();                                                                //Show the DLL version
     TSCLIB_DLL.openport("TSC TDP-245");                                                 //Open specified printer driver
     TSCLIB_DLL.setup("100", "63.5", "4", "8", "0", "0", "0");                           //Setup the media size and sensor type info
     TSCLIB_DLL.clearbuffer();                                                           //Clear image buffer
     TSCLIB_DLL.about();
     TSCLIB_DLL.barcode("100", "100", "128", "100", "1", "0", "2", "2", "Barcode Test"); //Drawing barcode
     TSCLIB_DLL.printerfont("100", "250", "TSS24.BF2", "0", "1", "1", "Print Font 测试");  //Drawing printer font
     // TSCLIB_DLL.windowsfont(100, 300, 24, 0, 0, 0, "GBK", "测试"); //Draw windows font
     // TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
     TSCLIB_DLL.sendcommand("PUTPCXL.PC 100,400,\"UL.PCX\"");                           //Drawing PCX graphic
     TSCLIB_DLL.printlabel("1", "1");                                                   //Print labels
     TSCLIB_DLL.closeport();                                                            //Close specified printer driver
 }
示例#20
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "msg", "alert('Hello TSCLIB.DLL')", true);
     //TSCLIB_DLL.about();                                                                 //Show the DLL version
     TSCLIB_DLL.openport("TSC TTP-245C");                                                //Open specified printer driver
     TSCLIB_DLL.setup("100", "63.5", "4", "8", "0", "0", "0");                           //Setup the media size and sensor type info
     TSCLIB_DLL.clearbuffer();                                                           //Clear image buffer
     TSCLIB_DLL.barcode("100", "100", "128", "100", "1", "0", "2", "2", "Barcode Test"); //Drawing barcode
     TSCLIB_DLL.printerfont("100", "250", "3", "0", "1", "1", "Print Font Test");        //Drawing printer font
     TSCLIB_DLL.windowsfont(100, 300, 24, 0, 0, 0, "ARIAL", "Windows Arial Font Test");  //Draw windows font
     //TSCLIB_DLL.downloadpcx("C:\\ASP.NET_in_VCsharp_2008\\ASP.NET_in_VCsharp_2008\\UL.PCX", "UL.PCX");                                         //Download PCX file into printer
     TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
     TSCLIB_DLL.sendcommand("PUTPCX 100,400,\"UL.PCX\"");                                //Drawing PCX graphic
     TSCLIB_DLL.printlabel("1", "1");                                                    //Print labels
     TSCLIB_DLL.closeport();
 }
        public void PrintBarcode(string zXPos, string zYPos, string zFont, string zHeight, string zPrintText,
                                 string zRotation, string zNB1, string zNB2, string zBarcode)
        {
            int labelNo = 0;

            while (labelNo < Convert.ToInt16(_labelsPerLine))
            {
                GlobalVariables.Logger.WriteToInfoLog(string.Format("args: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}",
                                                                    zXPos, zYPos, zFont, zHeight, zPrintText, zRotation, zNB1, zNB2, zBarcode));
                int xPos = Convert.ToInt16(zXPos) + (labelNo * Convert.ToInt16(_zNextPos));
                GlobalVariables.Logger.WriteToInfoLog(string.Format("args: {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}",
                                                                    xPos, zYPos, zFont, zHeight, zPrintText, zRotation, zNB1, zNB2, zBarcode));
                TSCLIB_DLL.barcode(xPos.ToString(), zYPos, zFont, zHeight, zPrintText, zRotation, zNB1, zNB2, zBarcode);
                labelNo++;
            }
        }
示例#22
0
        private void btnBack_Click(object sender, EventArgs e)//退纸
        {
            TSCLIB_DLL.openport("TSC TDP-245");

            int data = Convert.ToInt32(nudBack.Value);

            if (cb_Back.Checked)
            {
                TSCLIB_DLL.sendcommand("BACKFEED " + data);
            }
            else
            {
                TSCLIB_DLL.sendcommand("BACKUP " + data);
            }


            TSCLIB_DLL.closeport();
        }
示例#23
0
        /// <summary>
        /// 条码布局在下方
        /// </summary>
        /// <param name="m"></param>
        /// <param name="layout"></param>
        private void BarCode_BAPrint(InstrumentModel m)
        {
            // 设置标签 宽度、高度 等信息.
            // 宽 94mm  高 25mm
            // 速度为4
            // 字体浓度为8
            // 使用垂直間距感測器(gap sensor)
            // 两个标签之间的  间距为 3.5mm
            //TSCLIB_DLL.setup("35", "35", "1", "8", "1", "3.5", "0");
            // 清除缓冲信息
            TSCLIB_DLL.clearbuffer();
            // 打印条码.
            // 在 (176, 66) 的坐标上
            // 以 Code39 的条码方式
            // 条码高度 130
            // 打印条码的同时,还打印条码的文本信息.
            // 旋转的角度为 0 度
            // 条码 宽 窄 比例因子为 7:12
            // 条码内容为:barCode "200", "5", "128", "65", "1", "0", "2", "2"
            // 发送 TSPL 指令.
            // 设置 打印的方向.
            // 打印文本信息.
            // 在 (176, 16) 的坐标上
            // 字体高度为34
            // 旋转的角度为 0 度
            // 2 表示 粗体.
            // 文字没有下划线.
            // 字体为 黑体.
            // 打印的内容为:title

            TSCLIB_DLL.windowsfont(200, 10, 23, 0, 2, 0, "宋体", "名称:" + m.InstrumentName);

            TSCLIB_DLL.windowsfont(200, 50, 23, 0, 2, 0, "宋体", "仪器型号:" + m.Specification);
            TSCLIB_DLL.windowsfont(200, 90, 23, 0, 2, 0, "宋体", "资产编号:" + m.AssetsNo);
            TSCLIB_DLL.windowsfont(200, 130, 23, 0, 2, 0, "宋体", "出厂编号:" + m.SerialNo);
            TSCLIB_DLL.windowsfont(200, 170, 23, 0, 2, 0, "宋体", "管理编号:" + m.ManageNo);
            TSCLIB_DLL.barcode("280", "220", "128", "65", "1", "0", "2", "2", m.BarCode);


            // 打印.
            TSCLIB_DLL.printlabel("1", "1");
            // 关闭 打印机 端口
            TSCLIB_DLL.closeport();
        }
        public void PrintOverTSC(string model, List <LabelData> labelList)
        {
            if (labelList.Count == 0)
            {
                return;
            }

            try
            {
                TSCLIB_DLL.openport(model);

                foreach (LabelData l in labelList)
                {
                    TSCLIB_DLL.setup("75", "30", "4", "8", "0", "2", "0");
                    TSCLIB_DLL.clearbuffer();
                    TSCLIB_DLL.printerfont("24", "24", "4", "0", "1", "1", l.Device);
                    TSCLIB_DLL.windowsfont(24, 60, 32, 0, 0, 0, "Arial", l.Drawer);
                    TSCLIB_DLL.windowsfont(336, 24, 32, 0, 0, 0, "Arial", currentTime);

                    if (l.MedName.Length <= 43)
                    {
                        TSCLIB_DLL.windowsfont(16, 96, 32, 0, 0, 0, "Arial", l.MedName);
                    }
                    else
                    {
                        TSCLIB_DLL.windowsfont(16, 96, 32, 0, 0, 0, "Arial", l.MedName.Substring(0, 43));
                        TSCLIB_DLL.windowsfont(16, 128, 32, 0, 0, 0, "Arial", l.MedName.Substring(43));
                    }

                    TSCLIB_DLL.windowsfont(24, 182, 48, 0, 0, 0, "標楷體", $"數量: {l.Amount}");
                    TSCLIB_DLL.barcode("264", "166", "128", "56", "1", "0", "2", "1", l.MedID);
                    TSCLIB_DLL.printlabel("1", "1");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            finally
            {
                TSCLIB_DLL.closeport();
            }
        }
示例#25
0
        public bool PrintMUBLabel(string filePath)
        {
            try
            {
                // Open specified printer driver
                TSCLIB_DLL.openport(EnumDeviceNames.MUBLabelPrinter);

                // Setup the media size and sensor type info
                // page size 100mm x 55mm
                TSCLIB_DLL.setup("55", "100", "4", "8", "0", "0", "0");

                //Clear image buffer
                TSCLIB_DLL.clearbuffer();

                // Download PCX file into printer
                // TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");
                // Drawing PCX graphic
                TSCLIB_DLL.downloadpcx(filePath, "mublabel.bmp");       //Download PCX file into printer

                TSCLIB_DLL.sendcommand("PUTBMP 1,1, \"mublabel.bmp\""); //Drawing PCX graphic

                //Print labels
                //TSCLIB_DLL.printlabel("1", "1");
                TSCLIB_DLL.sendcommand("PRINT 1");
                TSCLIB_DLL.closeport();

                // Delete temp file
                File.Delete(filePath);

                return(true);
            }
            catch (Exception ex)
            {
                LogManager.Debug(ex.Message);
                Debug.WriteLine("Print exception: " + ex.ToString());
                // Delete temp file
                File.Delete(filePath);
                return(false);
            }
        }
示例#26
0
        private void button1_Click(object sender, EventArgs e)
        {
            byte[] result = System.Text.Encoding.GetEncoding("utf-16").GetBytes("unicode test");

            //TSCLIB_DLL.about();
            TSCLIB_DLL.openport("TSC TA210");
            TSCLIB_DLL.sendcommand("SIZE 76 mm, 20 mm");
            TSCLIB_DLL.sendcommand("SPEED 4");
            TSCLIB_DLL.sendcommand("DENSITY 12");
            TSCLIB_DLL.sendcommand("DIRECTION 1");
            TSCLIB_DLL.sendcommand("SET TEAR ON");
            TSCLIB_DLL.clearbuffer();
            TSCLIB_DLL.barcode("335", "30", "128", "100", "1", "0", "2", "2", "3410156300419176");
            TSCLIB_DLL.barcode("35", "30", "128", "100", "1", "0", "2", "2", "3410156300419176");
            //TSCLIB_DLL.printerfont("100", "250", "3", "0", "1", "1", "Print Font Test");
            //TSCLIB_DLL.windowsfont(100, 300, 24, 0, 0, 0, "ARIAL", "Windows Arial Font Test");
            //TSCLIB_DLL.windowsfontUnicode(100, 350, 24, 0, 0, 0, "ARIAL", result);
            TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");
            TSCLIB_DLL.sendcommand("PUTPCX 100,400,\"UL.PCX\"");
            TSCLIB_DLL.printlabel("4", "4");
            TSCLIB_DLL.closeport();
        }
示例#27
0
        public void Print(ExportDetail itm)
        {
            if (Export.SourceTransaction != "Sales Order")
            {
                return;
            }
            try
            {
                const int    VerticalSpace   = 150;
                const int    HorizontalSpace = 100;
                const string LabelFontSize   = "2.5";

                TSCLIB_DLL.openport(Settings.Default.TSCPrinter);                              //Open specified printer driver
                TSCLIB_DLL.setup("101", "150", "6", "8", "0", "5", "0");                       //Setup the media size and sensor type info
                TSCLIB_DLL.clearbuffer();                                                      //Clear image buffer
                TSCLIB_DLL.downloadpcx("box.pcx", "box.pcx");                                  //Download PCX file into printer

                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * .5).ToString(), "3", "0", "4", "4", "M.N.I.B.");
                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 1.25).ToString(), "3", "0", "1.75", "1.75", "Young Street, St. George's, Grenada");

                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 2.5).ToString(), "3", "0", LabelFontSize, LabelFontSize, Customer.CustomerName);
                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 3).ToString(), "3", "0", "1.75", "1.75", Customer.CustomerAddress);


                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 4).ToString(), "3", "0", "2", "2", DateTime.Today.ToString("yyyy-MMM-dd"));         //Drawing printer font


                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 4.5).ToString(), "3", "0", LabelFontSize, LabelFontSize, itm.Barcode);


                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 5).ToString(), "3", "0", LabelFontSize, LabelFontSize, Export.ProductDescription);

                TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 5.75).ToString(), "3", "0", "2", "2", Box.Description);

                TSCLIB_DLL.printerfont((HorizontalSpace * 3).ToString(), (VerticalSpace * 5.75).ToString(), "3", "0", "2", "2", itm.Weight.ToString());
                TSCLIB_DLL.printerfont((HorizontalSpace * 4).ToString(), (VerticalSpace * 5.75).ToString(), "3", "0", "2", "2", "LBS.");

                TSCLIB_DLL.barcode((HorizontalSpace * .5).ToString(), (VerticalSpace * 7).ToString(), "128", "125", "1", "0", "8", "8", itm.Barcode); //Drawing barcode

                //  TSCLIB_DLL.printerfont((HorizontalSpace * 2.3).ToString(), (VerticalSpace * 8.5).ToString(), "3", "0", "2", "2", Box.Description);

                //TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 4).ToString(), "3", "0", LabelFontSize, LabelFontSize, "SORT");
                //TSCLIB_DLL.sendcommand(string.Format("BOX {0},{1},{2},{3},4,19.2", HorizontalSpace * 4,VerticalSpace * 4,HorizontalSpace * 8,VerticalSpace * 4 + 100));

                //TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 5).ToString(), "3", "0", LabelFontSize, LabelFontSize, "GRADED");
                //TSCLIB_DLL.sendcommand(string.Format("BOX {0},{1},{2},{3},4,19.2", HorizontalSpace * 4, VerticalSpace * 5, HorizontalSpace * 8, VerticalSpace * 5 + 100));

                //TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 6).ToString(), "3", "0", LabelFontSize, LabelFontSize, "WASH");
                //TSCLIB_DLL.sendcommand(string.Format("BOX {0},{1},{2},{3},4,19.2", HorizontalSpace * 4, VerticalSpace * 6, HorizontalSpace * 8, VerticalSpace * 6 + 100));

                //TSCLIB_DLL.printerfont((HorizontalSpace * .5).ToString(), (VerticalSpace * 7).ToString(), "3", "0", LabelFontSize, LabelFontSize, "CHILLER#");
                //TSCLIB_DLL.sendcommand(string.Format("BOX {0},{1},{2},{3},4,19.2", HorizontalSpace * 4, VerticalSpace * 7, HorizontalSpace * 8, VerticalSpace * 7 + 100));


                TSCLIB_DLL.printlabel("1", "1");                                                    //Print labels
                TSCLIB_DLL.closeport();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public void SendToPrint(double numberOfPrints)
 {
     TSCLIB_DLL.printlabel("1", numberOfPrints.ToString());
     TSCLIB_DLL.closeport();
 }
 public void PrintLogo(string zXPos, string zYPos, string zPCXName)
 {
     TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");
     TSCLIB_DLL.sendcommand("PUTPCX 224,8,\"UL.PCX\"");
     TSCLIB_DLL.sendcommand("PUTPCX 576,8,\"UL.PCX\"");
 }
示例#30
0
        private void price10338()
        {
            try
            {
                int select_count = dgv_malzeme.SelectedRows.Count;
                if (select_count > 0)
                {
                    List <DataGridViewRow> rows =
                        (from DataGridViewRow row in dgv_malzeme.SelectedRows
                         where !row.IsNewRow
                         orderby row.Index
                         select row).ToList <DataGridViewRow>();
                    string price;
                    string price_cur;
                    string item_code;
                    string item_name;
                    string item_unit;
                    string printer_name = cmb_printer.Text;
                    string label_count  = labelCount.Value.ToString();
                    string price_with_cur;
                    int    point_number;
                    string point_number_s = "";

                    TSCLIB_DLL.openport(printer_name);
                    TSCLIB_DLL.sendcommand("SIZE 103 mm, 38 mm");
                    TSCLIB_DLL.sendcommand("SPEED 4");
                    TSCLIB_DLL.sendcommand("GAP 0 mm, 0 mm");
                    if (cmb_priceStyle.Text == "Ribonlı yazdırım")
                    {
                        TSCLIB_DLL.sendcommand("SET RIBBON ON");
                    }
                    else
                    {
                        TSCLIB_DLL.sendcommand("SET RIBBON OFF");
                    }
                    TSCLIB_DLL.sendcommand("DENSITY 8");
                    TSCLIB_DLL.sendcommand("DIRECTION 1");
                    TSCLIB_DLL.sendcommand("SET TEAR ON");
                    TSCLIB_DLL.sendcommand("CODEPAGE UTF-8");

                    for (int i = 0; i < select_count; i++)
                    {
                        price        = rows[i].Cells[3].Value.ToString();
                        price_cur    = rows[i].Cells[4].Value.ToString();
                        item_name    = rows[i].Cells[2].Value.ToString();
                        item_code    = rows[i].Cells[1].Value.ToString();
                        item_unit    = rows[i].Cells[5].Value.ToString();
                        point_number = Int32.Parse(rows[i].Cells[7].Value.ToString());
                        if (point_number > 0)
                        {
                            point_number_s = ".";
                            for (int j = 0; j < point_number; j++)
                            {
                                point_number_s += "0";
                            }
                        }
                        price = String.Format("{0:### ### ### ##0" + point_number_s + "}", float.Parse(price.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencyDecimalSeparator.ToString()).Replace(",", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencyDecimalSeparator.ToString())));

                        //MessageBox.Show(price);
                        // todo: orat suyshurmeli bolmasa page bellap bilenok
                        TSCLIB_DLL.clearbuffer();
                        switch (price.Length)

                        {
                        case 3:
                            TSCLIB_DLL.windowsfont(36, 15, 180, 0, 2, 0, "Agency FB", CenterString(price, 12));
                            TSCLIB_DLL.windowsfont(450, 75, 85, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 4:
                            TSCLIB_DLL.windowsfont(36, 15, 180, 0, 2, 0, "Agency FB", CenterString(price, 12));
                            TSCLIB_DLL.windowsfont(450, 75, 85, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 5:
                            TSCLIB_DLL.windowsfont(36, 15, 180, 0, 2, 0, "Agency FB", CenterString(price, 12));
                            TSCLIB_DLL.windowsfont(500, 75, 85, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 6:
                            TSCLIB_DLL.windowsfont(36, 15, 180, 0, 2, 0, "Agency FB", CenterString(price, 10));
                            TSCLIB_DLL.windowsfont(550, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 7:
                            TSCLIB_DLL.windowsfont(45, 15, 180, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(580, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 8:
                            TSCLIB_DLL.windowsfont(46, 15, 180, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(600, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 9:
                            TSCLIB_DLL.windowsfont(36, 15, 170, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(610, 78, 60, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        case 10:
                            TSCLIB_DLL.windowsfont(36, 15, 160, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(610, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                            break;

                        default:
                            TSCLIB_DLL.windowsfont(36, 15, 160, 0, 2, 0, "Agency FB", price);
                            TSCLIB_DLL.windowsfont(610, 88, 60, 0, 3, 0, "Century Gothic", price_cur);
                            break;
                        }

                        TSCLIB_DLL.windowsfont(30, 170, 48, 0, 2, 0, "Century Gothic", CenterString(item_code, 32));
                        if (item_name.Length > 40)
                        {
                            TSCLIB_DLL.windowsfont(30, 230, 32, 0, 2, 0, "Century Gothic", CenterString(item_name, 55));
                        }
                        else if (item_name.Length > 30)
                        {
                            TSCLIB_DLL.windowsfont(30, 230, 35, 0, 2, 0, "Century Gothic", CenterString(item_name, 45));
                        }
                        else
                        {
                            TSCLIB_DLL.windowsfont(24, 230, 38, 0, 2, 0, "Century Gothic", CenterString(item_name, 50));
                        }
                        TSCLIB_DLL.windowsfont(650, 270, 35, 0, 3, 0, "Century Gothic", item_unit);

                        TSCLIB_DLL.printlabel("1", label_count);
                    }
                    TSCLIB_DLL.closeport();
                }
            }
            catch (Exception e)
            {
                Log.set("HATA: PriceForm>8035 print()\nEXCEPTION:" + e.ToString());
            }
        }