哪哥们能帮我把以下C#.net代码转为VB.net代码
using System;
using System.Runtime.InteropServices;
//using System.Windows.Forms;
namespace Beiyang
{
/// <summary>
/// Bpladll 的摘要说明。
/// </summary>
public class PrinterDll
{
public const int BPLA_OK = 1000; //一切正常
public const int BPLA_COMERROR = 1001; //通讯错或者未联接打印机
public const int BPLA_PARAERROR = 1002; //参数错误
public const int BPLA_FILEOPENERROR = 1003; //文件打开错误
public const int BPLA_FILEREADERROR = 1004; //文件读错误
public const int BPLA_FILEWRITEERROR = 1005; //文件写错误
public const int BPLA_FILEERROR = 1006; //文件不合要求
public const int BPLA_NUMBEROVER = 1007; //指定的接收信息数量过大
public const int BPLA_IMAGETYPEERROR = 1008; //图象文件格式不正确
//static string m_dllpath = Application.StartupPath+@"\BPLADLL.dll";
[DllImport("BPLADLL.dll")]
public static extern int BPLA_OpenCom(string comname, int intbaudrate, int handshake);
//打开串口
[DllImport("BPLADLL.dll")]
public static extern int BPLA_OpenComEx(string comname, int intbaudrate, int handshake,int WriteTimeOut);
//关闭串口
[DllImport("BPLADLL.dll")]
public static extern int BPLA_CloseCom();
//打开并口
[DllImport("BPLADLL.dll")]
public static extern int BPLA_OpenLpt(int address, int busySleep);
// Setdirectory
//关闭并口
[DllImport("BPLADLL.dll")]
public static extern int BPLA_CloseLpt();
//打开USB口
[DllImport("BPLADLL.dll")]
public static extern int BPLA_OpenUsb();
//关闭USB口
[DllImport("BPLADLL.dll")]
public static extern int BPLA_CloseUsb();
//打开驱动
[DllImport("BPLADLL.dll")]
public static extern int BPLA_OpenPrinterDriver(string DriverName);
//关闭驱动
[DllImport("BPLADLL.dll")]
public static extern int BPLA_ClosePrinterDriver();
//开启打印作业
[DllImport("BPLADLL.dll")]
public static extern int BPLA_StartDoc();
//关闭打印作业
[DllImport("BPLADLL.dll")]
public static extern int BPLA_EndDoc();
//设置端口超时
[DllImport("BPLADLL.dll")]
public static extern int BPLA_SetTimeOut(int WriteTimeOut);
//保存文件
[DllImport("BPLADLL.dll")]
public static extern int BPLA_SetSaveFile(bool bsave,string filename,bool bport);
//进入标签
[DllImport("BPLADLL.dll")]
public static extern int BPLA_SetPaperLength(int PaperLength,int Length);
//进入标签
[DllImport("BPLADLL.dll")]
public static extern int BPLA_StartArea(int unitmode,int printwidth,int column,int row,int darkness,int speedprint,int speedfor,int speedbac);
//整体翻转
[DllImport("BPLADLL.dll")]
public static extern int BPLA_SetAllRotate(int rotatemode);
//打印标签
[DllImport("BPLADLL.dll")]
public static extern int BPLA_Print(int pieces,int samepieces,int outunit);
//直线
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintLine(int startx,int starty,int endx,int endy,int linewidth);
//内部字体0-8、000-007和P06-P18
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintText(string text,int startx,int starty,int rotate,int fonttype,int pointwidth,int pointheight,string addvalue,int space,int bitmode);
//已经下载的外部字体打印
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintOut(string text,int startx,int starty,int rotate,string fonttype,int pointwidth,int pointheight,string addvalue,int space,int bitmode);
//中英文混和打印
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintMixText(string text,int startx,int en_starty,int cn_starty,int rotate,int en_fonttype,string cn_fonttype,int en_width,int cn_width,int pointwidth,int pointheight,string addvalue,int space,int bitmode);
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintMixTextEx(string text,int startx,int en_starty,int xy_adjust,int rotate,string en_fonttype,string cn_fonttype,int pointwidth,int pointheight,string addvalue,int space,int bitmode);
//打印TRUETYPE字体
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintTruetype(string text,int startx,int starty,string fontname,int fontheight,int fontwidth);
//打印图像
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintImage(string filename,int startx,int starty,int bitmode);
//一维条码
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintBarcode(string codedata,int startx,int starty,int rotate,int bartype,int height,int number,int numberbase,string addvalue);
//PDF码
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintPDF(string codedata,int startx,int starty,int rotate,int basewidth,int baseheight,int scalewidth,int scaleheight,int row,int column,int cutmode,int level,int length,string addvalue);
//测试状态
[DllImport("BPLADLL.dll")]
public static extern int BPLA_CheckStatus(byte[] papershort,byte[] ribbionshort,byte[] busy,byte[] pause,byte[] com,byte[] headheat,byte[] headover,byte[] cut);
}
}
using System.Runtime.InteropServices;
//using System.Windows.Forms;
namespace Beiyang
{
/// <summary>
/// Bpladll 的摘要说明。
/// </summary>
public class PrinterDll
{
public const int BPLA_OK = 1000; //一切正常
public const int BPLA_COMERROR = 1001; //通讯错或者未联接打印机
public const int BPLA_PARAERROR = 1002; //参数错误
public const int BPLA_FILEOPENERROR = 1003; //文件打开错误
public const int BPLA_FILEREADERROR = 1004; //文件读错误
public const int BPLA_FILEWRITEERROR = 1005; //文件写错误
public const int BPLA_FILEERROR = 1006; //文件不合要求
public const int BPLA_NUMBEROVER = 1007; //指定的接收信息数量过大
public const int BPLA_IMAGETYPEERROR = 1008; //图象文件格式不正确
//static string m_dllpath = Application.StartupPath+@"\BPLADLL.dll";
[DllImport("BPLADLL.dll")]
public static extern int BPLA_OpenCom(string comname, int intbaudrate, int handshake);
//打开串口
[DllImport("BPLADLL.dll")]
public static extern int BPLA_OpenComEx(string comname, int intbaudrate, int handshake,int WriteTimeOut);
//关闭串口
[DllImport("BPLADLL.dll")]
public static extern int BPLA_CloseCom();
//打开并口
[DllImport("BPLADLL.dll")]
public static extern int BPLA_OpenLpt(int address, int busySleep);
// Setdirectory
//关闭并口
[DllImport("BPLADLL.dll")]
public static extern int BPLA_CloseLpt();
//打开USB口
[DllImport("BPLADLL.dll")]
public static extern int BPLA_OpenUsb();
//关闭USB口
[DllImport("BPLADLL.dll")]
public static extern int BPLA_CloseUsb();
//打开驱动
[DllImport("BPLADLL.dll")]
public static extern int BPLA_OpenPrinterDriver(string DriverName);
//关闭驱动
[DllImport("BPLADLL.dll")]
public static extern int BPLA_ClosePrinterDriver();
//开启打印作业
[DllImport("BPLADLL.dll")]
public static extern int BPLA_StartDoc();
//关闭打印作业
[DllImport("BPLADLL.dll")]
public static extern int BPLA_EndDoc();
//设置端口超时
[DllImport("BPLADLL.dll")]
public static extern int BPLA_SetTimeOut(int WriteTimeOut);
//保存文件
[DllImport("BPLADLL.dll")]
public static extern int BPLA_SetSaveFile(bool bsave,string filename,bool bport);
//进入标签
[DllImport("BPLADLL.dll")]
public static extern int BPLA_SetPaperLength(int PaperLength,int Length);
//进入标签
[DllImport("BPLADLL.dll")]
public static extern int BPLA_StartArea(int unitmode,int printwidth,int column,int row,int darkness,int speedprint,int speedfor,int speedbac);
//整体翻转
[DllImport("BPLADLL.dll")]
public static extern int BPLA_SetAllRotate(int rotatemode);
//打印标签
[DllImport("BPLADLL.dll")]
public static extern int BPLA_Print(int pieces,int samepieces,int outunit);
//直线
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintLine(int startx,int starty,int endx,int endy,int linewidth);
//内部字体0-8、000-007和P06-P18
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintText(string text,int startx,int starty,int rotate,int fonttype,int pointwidth,int pointheight,string addvalue,int space,int bitmode);
//已经下载的外部字体打印
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintOut(string text,int startx,int starty,int rotate,string fonttype,int pointwidth,int pointheight,string addvalue,int space,int bitmode);
//中英文混和打印
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintMixText(string text,int startx,int en_starty,int cn_starty,int rotate,int en_fonttype,string cn_fonttype,int en_width,int cn_width,int pointwidth,int pointheight,string addvalue,int space,int bitmode);
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintMixTextEx(string text,int startx,int en_starty,int xy_adjust,int rotate,string en_fonttype,string cn_fonttype,int pointwidth,int pointheight,string addvalue,int space,int bitmode);
//打印TRUETYPE字体
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintTruetype(string text,int startx,int starty,string fontname,int fontheight,int fontwidth);
//打印图像
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintImage(string filename,int startx,int starty,int bitmode);
//一维条码
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintBarcode(string codedata,int startx,int starty,int rotate,int bartype,int height,int number,int numberbase,string addvalue);
//PDF码
[DllImport("BPLADLL.dll")]
public static extern int BPLA_PrintPDF(string codedata,int startx,int starty,int rotate,int basewidth,int baseheight,int scalewidth,int scaleheight,int row,int column,int cutmode,int level,int length,string addvalue);
//测试状态
[DllImport("BPLADLL.dll")]
public static extern int BPLA_CheckStatus(byte[] papershort,byte[] ribbionshort,byte[] busy,byte[] pause,byte[] com,byte[] headheat,byte[] headover,byte[] cut);
}
}
...全文
相关推荐
C#代码项目转换VB.NET项目代码(可整个项目转换)
C#代码项目转换VB.NET项目代码(可整个项目转换)C#代码项目转换VB.NET项目代码(可整个项目转换)
VB.NET 环境下 MQTT 通信实战:从客户端到嵌入式 Broker 全解析
在工业物联网与上位机数据采集场景中,设备远程通信和跨网段组网需求日益迫切,传统串口与 Modbus 方式已难以满足“数据上云”和“MES 对接”的灵活要求。MQTT 作为一种轻量级发布/订阅消息协议,基于 Broker 进行消息转发,具有低带宽、高实时性和松耦合等特性,成为工业设备接入与数据采集的首选方案。当老系统基于 .NET 技术栈(如 VB.NET WinForms)维护时,利用开源库 M2Mqtt 即可快速为原有上位机增加 MQTT 通信能力,无需重写业务层。本文将围绕 MQTT 协议核心概念(主题
C#代码转换为VB.NET代码的工具
C#代码转换为VB.NET代码的工具,直接运行即可转换
C#与Vb.net代码互转工具
在离线状态下,可将C#转为Vb.net代码,或将Vb.net转为c#代码,非常简单方便。
VB.Net to C# Converter将VB代码转换成C#代码
本资源为【VB.Net to C# Converter】软件,它可以将VB代码转换成C#代码,效果很好


