• 大小: 361KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-08-04
  • 语言: C#
  • 标签: 佳博  标签  热敏  C#  

资源简介

C#调用佳博打印机打印标签源码,自测环境:win8+vs10,用管理员权限打开项目即可

资源截图

代码片段和文件信息

using System;
using System.IO;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO.Ports;
using System.Windows.Forms;
using GprinterTest;

namespace POSdllDemo
{
    public partial class Form1 : Form
    {
        private IntPtr Gp_IntPtr;                   //驱动打印句柄
        private libUsbContorl.UsbOperation NewUsb=new libUsbContorl.UsbOperation();
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            LoadPOSDll PosPrint = new LoadPOSDll();
            
//POS_COM_DTR_DSR 0x00 流控制为DTR/DST  
//POS_COM_RTS_CTS 0x01 流控制为RTS/CTS 
//POS_COM_XON_XOFF 0x02 流控制为XON/OFF 
//POS_COM_NO_HANDSHAKE 0x03 无握手 
//POS_OPEN_PARALLEL_PORT 0x12 打开并口通讯端口 
//POS_OPEN_BYUSB_PORT 0x13 打开USB通讯端口 
//POS_OPEN_PRINTNAME 0X14 打开打印机驱动程序 
//POS_OPEN_NETPORT 0x15 打开网络接口 

            if (PosPrint.OpenNetPort(“192.168.0.123“))//当参数nParam的值为POS_OPEN_NETPORT时,表示打开指定的网络接口,如“192.168.10.251”表示网络接口IP地址,打印时参考
            {
                Gp_IntPtr = PosPrint.POS_IntPtr;
            }
            if (LoadPOSDll.POS_StartDoc())
            {
                byte[] by_SendData = System.Text.Encoding.Default.GetBytes(“test print\r\n“);
                LoadPOSDll.POS_WriteFile(PosPrint.POS_IntPtr by_SendData (uint)by_SendData.Length);
                LoadPOSDll.POS_WriteFile(PosPrint.POS_IntPtr new byte[] { 0x0a } 1);
                LoadPOSDll.POS_EndDoc();
            }
        }
        /// 
        /// Usb 发衣单打印
        /// 

        /// 
        /// 
        private void button6_Click(object sender EventArgs e)
        {
            
        }
        private void button2_Click(object sender EventArgs e)
        {
         NewUsb.FindUSBPrinter();
         for(int i=0;i         {
         if(NewUsb.linkUSB(i))
         {
         byte[] shiftsize={0x1d0x570xd00x01};//偏移量
         byte[] KanjiMode={0x1c0x26};//汉字模式
        
         SendData2USB(shiftsize);
         SendData2USB(KanjiMode);
        
         #region 打印信息测试
         string strPrintwidth=“48毫米“;
         string strPrintDensity=“384点/行“;
         string strPrintSpeed=“90毫米/秒“;
         string strPrintLiftTime=“50公里“;
         string strPowerSupply=“DC 12V/4A“;
         string strSerialInfo=“有“;
         string strParInfo=“无“;
         string strUSBInfo=“USB2.0协议“;
         string strWirelessInfo=“无“;
         string strNetInfo=“无“;
        
         string strSend;
         byte[] SendData={0x1b0x610x010x1b0x210x300x1c0x570x01};
         byte[] enddata={0x0a};//换行
        
         SendData2USB(Sen

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4094  2014-09-11 13:27  POSdllDemo(C#)\POSdllDemo\05.bmp

     文件       4094  2014-09-11 13:27  POSdllDemo(C#)\POSdllDemo\06.bmp

     文件       4094  2014-09-11 13:27  POSdllDemo(C#)\POSdllDemo\07.bmp

     文件       4094  2014-09-11 13:27  POSdllDemo(C#)\POSdllDemo\08.bmp

     文件       4094  2014-09-11 13:27  POSdllDemo(C#)\POSdllDemo\09.bmp

     文件       4094  2014-09-11 13:27  POSdllDemo(C#)\POSdllDemo\10.bmp

     文件       2373  2016-04-28 13:17  POSdllDemo(C#)\POSdllDemo\app.manifest

     文件     113664  2016-04-28 13:57  POSdllDemo(C#)\POSdllDemo\bin\Debug\libUsbContorl.dll

     文件      28672  2016-05-11 14:26  POSdllDemo(C#)\POSdllDemo\bin\Debug\POSdllDemo.exe

     文件      40448  2016-05-11 14:26  POSdllDemo(C#)\POSdllDemo\bin\Debug\POSdllDemo.pdb

     文件      11608  2016-05-11 14:23  POSdllDemo(C#)\POSdllDemo\bin\Debug\POSdllDemo.vshost.exe

     文件        490  2013-06-18 20:28  POSdllDemo(C#)\POSdllDemo\bin\Debug\POSdllDemo.vshost.exe.manifest

     文件      21757  2016-05-11 14:26  POSdllDemo(C#)\POSdllDemo\Form1.cs

     文件      17719  2016-04-28 14:33  POSdllDemo(C#)\POSdllDemo\Form1.Designer.cs

     文件       6187  2016-04-28 14:33  POSdllDemo(C#)\POSdllDemo\Form1.resx

     文件     113664  2016-04-28 13:57  POSdllDemo(C#)\POSdllDemo\libUsbContorl.dll

     文件     109568  2015-08-12 16:45  POSdllDemo(C#)\POSdllDemo\libUsbContorl2.dll

     文件      33280  2007-07-18 15:57  POSdllDemo(C#)\POSdllDemo\libUsbContorl22.dll

     文件      61440  2016-04-27 11:55  POSdllDemo(C#)\POSdllDemo\LibUsbDotNet.dll

     文件      31681  2015-05-06 18:05  POSdllDemo(C#)\POSdllDemo\LoadPOSDll.cs

     文件       1229  2016-04-27 09:22  POSdllDemo(C#)\POSdllDemo\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       5397  2016-05-11 14:26  POSdllDemo(C#)\POSdllDemo\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       5406  2016-05-11 14:26  POSdllDemo(C#)\POSdllDemo\obj\x86\Debug\POSdllDemo.csproj.FileListAbsolute.txt

     文件        975  2016-04-29 17:20  POSdllDemo(C#)\POSdllDemo\obj\x86\Debug\POSdllDemo.csproj.GenerateResource.Cache

     文件       6883  2016-05-11 14:26  POSdllDemo(C#)\POSdllDemo\obj\x86\Debug\POSdllDemo.csprojResolveAssemblyReference.cache

     文件      28672  2016-05-11 14:26  POSdllDemo(C#)\POSdllDemo\obj\x86\Debug\POSdllDemo.exe

     文件        180  2016-04-29 17:20  POSdllDemo(C#)\POSdllDemo\obj\x86\Debug\POSdllDemo.Form1.resources

     文件      40448  2016-05-11 14:26  POSdllDemo(C#)\POSdllDemo\obj\x86\Debug\POSdllDemo.pdb

     文件        180  2016-04-29 17:20  POSdllDemo(C#)\POSdllDemo\obj\x86\Debug\POSdllDemo.Properties.Resources.resources

     文件       5597  2015-09-26 12:02  POSdllDemo(C#)\POSdllDemo\obj\x86\Release\DesignTimeResolveAssemblyReferencesInput.cache

............此处省略34个文件信息

评论

共有 条评论