コード例 #1
0
 private void print(bool result)
 {
     TSCLib.openport("TSC TTP-344M Plus");
     //设置打印机
     TSCLib.setup("32", "17.5", "4", "14", "0", "0", "0");
     TSCLib.clearbuffer();
     //第一行文字
     TSCLib.windowsfont(60, 40, 28, 0, 0, 0, "Times new Roman", "S/N:ABCDEF123456");
     //第二行二维码样式
     TSCLib.barcode("60", "70", "128", "40", "0", "0", "2", "2", "ABCDEF123456");
     //第三行文字
     TSCLib.windowsfont(60, 120, 28, 0, 0, 0, "Times new Roman", "IMEI:123456789012345");
     //第四行文字
     TSCLib.barcode("60", "150", "128", "40", "0", "0", "2", "2", "123456789012345");
     TSCLib.printlabel("1", "1");
     TSCLib.closeport();
 }
コード例 #2
0
        private void print(int count)
        {
            if (count > labelColumnCount)
            {
                return;
            }

            TSCLib.openport(Settings.Default.Printer);


            //打印机参数
            string l_width    = (Settings.Default.LabelWidth * labelColumnCount + labelGap * (labelColumnCount - 1)).ToString();
            string l_height   = (Settings.Default.LabelHeight + labelGap).ToString();
            string p_speed    = Settings.Default.PrintSpeed.ToString();
            string p_density  = Settings.Default.PrintDensity.ToString();
            string p_sensor   = Settings.Default.Sensor.ToString();
            string p_vertical = Settings.Default.Vertical.ToString();
            string p_offset   = Settings.Default.Offset.ToString();

            //设置打印机

            TSCLib.setup(l_width, l_height, p_speed, p_density, p_sensor, p_vertical, p_offset);
            TSCLib.clearbuffer();



            for (int index = 0; index < count; index++)
            {
                //字体样式
                int t_x          = Settings.Default.T_X;
                int t_y          = Settings.Default.T_Y;
                int t_height     = Settings.Default.T_H;
                int t_rotation   = Settings.Default.T_R;
                int t_font_style = Settings.Default.T_S;
                int t_under_line = Settings.Default.T_L;

                //条码样式
                string b_y        = (t_y + t_height + Settings.Default.Gap1).ToString();
                string b_height   = Settings.Default.B_Height.ToString();
                string b_readable = Settings.Default.B_Readable.ToString();
                string b_rotation = Settings.Default.B_Rotation.ToString();
                string b_narrow   = Settings.Default.B_Narrow.ToString();
                string b_wide     = Settings.Default.B_Wide.ToString();

                if (index > 0)
                {
                    t_x = 30 * 12 * index + 2 * 12 * index + t_x;
                }
                //打印SN字符
                TSCLib.windowsfont(t_x, t_y, t_height, 0, t_font_style, t_under_line, "Times new Roman", "HCL S/N:" + sn);


                //打印SN条码
                TSCLib.barcode(t_x.ToString(), b_y, "128", b_height, b_readable, "0", b_narrow, b_wide, sn);

                //打印IMEI字符
                t_y = Convert.ToInt32(b_y) + Settings.Default.B_Height + Settings.Default.Gap2;
                TSCLib.windowsfont(t_x, t_y, t_height, 0, t_font_style, t_under_line, "Times new Roman", "IMEI:" + imei);
                b_y = (t_y + t_height + Settings.Default.Gap1).ToString();
                TSCLib.barcode(t_x.ToString(), b_y, "128", b_height, b_readable, "0", b_narrow, b_wide, imei);
            }


            TSCLib.printlabel("1", "1");
            TSCLib.closeport();
            TSCLib.formfeed();
        }