• 大小: 1.73MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-11
  • 语言: C#
  • 标签: C#  Godex  打印  

资源简介

C#调用打印机的驱动指令函数 实现打印各种条码功能

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.xml;
using System.IO;
using System.Runtime.InteropServices;
using System.Collections;

namespace DLLImport
{
    public partial class DLLImport : Form
    {
        public DLLImport()
        {
            InitializeComponent();
        }
        [DllImport(“Trace.dll“)]
        public static extern void setup(int a int b int c int d int e int f);

        [DllImport(“Trace.dll“)]
        public static extern void setbaudrate(int n);

        [DllImport(“Trace.dll“)]
        public static extern void SetTimeOutTicks(int ms);

        // n = 0 → LPT1 
        // n = 1 → COM1 
        // n = 2 → COM2 
        // n = 3 → COM3 
        // n = 4 → COM4 
        // n = 5 → LPT2 
        // n = 6 → USB         
        [DllImport(“Trace.dll“)]
        public static extern void openport(
            [MarshalAs(UnmanagedType.LPStr)]
            string n);

        [DllImport(“Trace.dll“)]
        public static extern void closeport();


        [DllImport(“Trace.dll“)]
        public static extern void sendcommand(
            [MarshalAs(UnmanagedType.LPArray)]
            byte[] command);

        [DllImport(“Trace.dll“)]
        public static extern void sendcommand(
            [MarshalAs(UnmanagedType.LPStr)]
            string command);

        // 1 -> Success 0 -> Fail
        [DllImport(“Trace.dll“)]
        public static extern int isready();


        [DllImport(“Trace.dll“)]
        public static extern void intloadimage(
            [MarshalAs(UnmanagedType.LPStr)]
            string filename
            [MarshalAs(UnmanagedType.LPStr)]
            string image_name
            [MarshalAs(UnmanagedType.LPStr)]
            string image_type);

        [DllImport(“Trace.dll“)]
        public static extern void extloadimage(
            [MarshalAs(UnmanagedType.LPStr)]
            string filename
            [MarshalAs(UnmanagedType.LPStr)]
            string image_name
            [MarshalAs(UnmanagedType.LPStr)]
            string image_type);

        // 1 -> Success 0 -> Fail
        [DllImport(“Trace.dll“)]
        public static extern int ecTextOut(int x int y int b
            [MarshalAs(UnmanagedType.LPStr)]
            string c
            [MarshalAs(UnmanagedType.LPStr)]
            string d);

        // 1 -> Success 0 -> Fail
        [DllImport(“Trace.dll“)]
        public static extern int ecTextOutR(int x int y int b
            [MarshalAs(UnmanagedType.LPStr)]
            string c
            [MarshalAs(UnmanagedType.LPStr)]
            string d int e int f int g);

        // 1 -> Success 0 -> Fail
        [DllImport(“Trace.dll“)]
        public static extern int ecTextDownLoad(int b stri

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-06-04 09:48  DLLImport\
     目录           0  2013-06-05 09:29  DLLImport\DLLImport\
     文件         921  2011-08-23 17:44  DLLImport\DLLImport.sln
     文件       16896  2013-06-05 09:31  DLLImport\DLLImport.suo
     目录           0  2013-06-04 09:45  DLLImport\DLLImport\bin\
     目录           0  2013-06-04 09:45  DLLImport\DLLImport\bin\Debug\
     文件       14336  2013-06-05 09:29  DLLImport\DLLImport\bin\Debug\DLLImport.exe
     文件       44544  2013-06-05 09:29  DLLImport\DLLImport\bin\Debug\DLLImport.pdb
     文件       14328  2013-06-05 09:29  DLLImport\DLLImport\bin\Debug\DLLImport.vshost.exe
     文件         490  2007-07-21 01:33  DLLImport\DLLImport\bin\Debug\DLLImport.vshost.exe.manifest
     文件         119  2013-06-03 18:18  DLLImport\DLLImport\bin\Debug\Sample.cmd
     文件      167936  2011-08-09 08:36  DLLImport\DLLImport\bin\Debug\Trace.dll
     目录           0  2013-06-04 09:45  DLLImport\DLLImport\bin\Release\
     文件        3724  2011-08-23 17:55  DLLImport\DLLImport\DLLImport.csproj
     文件          74  2011-08-23 17:44  DLLImport\DLLImport\DLLImport.csproj.user
     文件       18479  2013-06-05 09:29  DLLImport\DLLImport\Main.cs
     文件        6851  2013-06-05 09:29  DLLImport\DLLImport\Main.Designer.cs
     文件        5814  2013-06-05 09:29  DLLImport\DLLImport\Main.resx
     目录           0  2013-06-04 09:45  DLLImport\DLLImport\obj\
     目录           0  2013-06-05 09:29  DLLImport\DLLImport\obj\Debug\
     文件        3460  2013-06-05 09:29  DLLImport\DLLImport\obj\Debug\DLLImport.csproj.FileListAbsolute.txt
     文件         904  2013-06-05 09:29  DLLImport\DLLImport\obj\Debug\DLLImport.csproj.GenerateResource.Cache
     文件         180  2013-06-05 09:29  DLLImport\DLLImport\obj\Debug\DLLImport.DLLImport.resources
     文件       14336  2013-06-05 09:29  DLLImport\DLLImport\obj\Debug\DLLImport.exe
     文件       44544  2013-06-05 09:29  DLLImport\DLLImport\obj\Debug\DLLImport.pdb
     文件         180  2011-08-23 17:55  DLLImport\DLLImport\obj\Debug\DLLImport.Properties.Resources.resources
     目录           0  2013-06-04 09:45  DLLImport\DLLImport\obj\Debug\Refactor\
     目录           0  2013-06-04 09:45  DLLImport\DLLImport\obj\Debug\TempPE\
     目录           0  2013-06-04 09:45  DLLImport\DLLImport\obj\Release\
     文件         497  2011-08-23 17:53  DLLImport\DLLImport\Program.cs
     目录           0  2013-06-04 09:45  DLLImport\DLLImport\Properties\
............此处省略6个文件信息

评论

共有 条评论