private void PRINT_Click(object sender, EventArgs e)
 {
     TSCLIB_DLL.openport("USB");
     foreach (DataGridViewRow row in dataGridViewMT.Rows)
     {
         printLabels(row.Cells[2].Value.ToString(), row.Cells[8].Value.ToString(), row.Cells[3].Value.ToString());
     }
     TSCLIB_DLL.closeport();
 }
        private void printLabels(string invNumber, string SN, string PC_Name)
        {
            string numbeSN = "SN: " + SN;
            string NamePC  = "PC: " + PC_Name;

            TSCLIB_DLL.setup("37", "70", "5", "15", "1", "3", "0");
            //TSCLIB_DLL.sendcommand("GAP 3");
            //TSCLIB_DLL.sendcommand("DIRECTION 0");
            //TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");
            //TSCLIB_DLL.sendcommand("PUTPCX 148,48,\"UL.PCX\"");
            //TSCLIB_DLL.sendcommand("SPEED 2");
            TSCLIB_DLL.sendcommand("SET PARTIAL_CUTTER OFF");
            TSCLIB_DLL.sendcommand("CLS");
            TSCLIB_DLL.sendcommand("BARCODE 96, 525, \"128\", 96, 0,270,3,2,\"" + invNumber + "\"");
            TSCLIB_DLL.windowsfont(28, 525, 64, 90, 0, 0, "ARIAL", invNumber);
            TSCLIB_DLL.windowsfont(196, 525, 32, 90, 1, 0, "ARIAL", numbeSN);
            TSCLIB_DLL.windowsfont(232, 525, 32, 90, 1, 0, "ARIAL", NamePC);
            TSCLIB_DLL.downloadpcx(Properties.Settings.Default.ImgPath, "LOG2.BMP");
            TSCLIB_DLL.sendcommand("PUTBMP 44,25,\"LOG2.BMP\"");
            //TSCLIB_DLL.sendcommand("CUT");

            //Open specified printer driver
            //   TSCLIB_DLL.setup("37", "70", "4", "12", "0", "1", "1");                              //Setup the media size and sensor type info
            // TSCLIB_DLL.clearbuffer();                                                             //Clear image buffer
            //TSCLIB_DLL.barcode("78", "491", "128M", "136", "1", "270", "2", "2", "19012016565");   //Drawing barcode
            //TSCLIB_DLL.printerfont("24", "491", "3", "270", "1", "1", "S/N: 011642042");          //Drawing printer font
            //TSCLIB_DLL.windowsfont(48, 491, 24, 90, 1, 0, "ARIAL", "NAME: MN-ADPC02");            //Draw windows font
            // TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
            // TSCLIB_DLL.sendcommand("PUTPCX 136,70,\"UL.PCX\"");                                 // TSCLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");                                         //Download PCX file into printer
            // TSCLIB_DLL.sendcommand("PUTPCX 136,70,\"UL.PCX\"");                                //Drawing PCX graphic
            TSCLIB_DLL.printlabel("1", "1");
            TSCLIB_DLL.sendcommand("CUT");

            //Print labels
            //TSCLIB_DLL.closeport();
        }