哪哥们能帮我把以下C#.net代码转为VB.net代码

billow_chentao 2009-02-26 02:06:21
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);

}
}
...全文
197 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Bullatus 2009-02-26
  • 打赏
  • 举报
回复
好长啊……同意使用转换工具~
yanlongwuhui 2009-02-26
  • 打赏
  • 举报
回复
转换工具
http://www.developerfusion.com/tools/convert/csharp-to-vb/
wangzhenyue 2009-02-26
  • 打赏
  • 举报
回复
Imports System
Imports System.Runtime.InteropServices
'using System.Windows.Forms;
Namespace Beiyang
''' <summary>
''' Bpladll 的摘要说明。
''' </summary>
Public Class PrinterDll
Public Const BPLA_OK As Integer = 1000
Public Const BPLA_COMERROR As Integer = 1001
Public Const BPLA_PARAERROR As Integer = 1002
Public Const BPLA_FILEOPENERROR As Integer = 1003
Public Const BPLA_FILEREADERROR As Integer = 1004
Public Const BPLA_FILEWRITEERROR As Integer = 1005
Public Const BPLA_FILEERROR As Integer = 1006
Public Const BPLA_NUMBEROVER As Integer = 1007
Public Const BPLA_IMAGETYPEERROR As Integer = 1008
'static string m_dllpath = Application.StartupPath+@"\BPLADLL.dll";
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_OpenCom(ByVal comname As String, ByVal intbaudrate As Integer, ByVal handshake As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_OpenComEx(ByVal comname As String, ByVal intbaudrate As Integer, ByVal handshake As Integer, ByVal WriteTimeOut As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_CloseCom() As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_OpenLpt(ByVal address As Integer, ByVal busySleep As Integer) As Integer
End Function
' Setdirectory
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_CloseLpt() As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_OpenUsb() As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_CloseUsb() As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_OpenPrinterDriver(ByVal DriverName As String) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_ClosePrinterDriver() As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_StartDoc() As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_EndDoc() As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_SetTimeOut(ByVal WriteTimeOut As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_SetSaveFile(ByVal bsave As Boolean, ByVal filename As String, ByVal bport As Boolean) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_SetPaperLength(ByVal PaperLength As Integer, ByVal Length As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_StartArea(ByVal unitmode As Integer, ByVal printwidth As Integer, ByVal column As Integer, ByVal row As Integer, ByVal darkness As Integer, ByVal speedprint As Integer, _
ByVal speedfor As Integer, ByVal speedbac As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_SetAllRotate(ByVal rotatemode As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_Print(ByVal pieces As Integer, ByVal samepieces As Integer, ByVal outunit As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_PrintLine(ByVal startx As Integer, ByVal starty As Integer, ByVal endx As Integer, ByVal endy As Integer, ByVal linewidth As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_PrintText(ByVal text As String, ByVal startx As Integer, ByVal starty As Integer, ByVal rotate As Integer, ByVal fonttype As Integer, ByVal pointwidth As Integer, _
ByVal pointheight As Integer, ByVal addvalue As String, ByVal space As Integer, ByVal bitmode As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_PrintOut(ByVal text As String, ByVal startx As Integer, ByVal starty As Integer, ByVal rotate As Integer, ByVal fonttype As String, ByVal pointwidth As Integer, _
ByVal pointheight As Integer, ByVal addvalue As String, ByVal space As Integer, ByVal bitmode As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_PrintMixText(ByVal text As String, ByVal startx As Integer, ByVal en_starty As Integer, ByVal cn_starty As Integer, ByVal rotate As Integer, ByVal en_fonttype As Integer, _
ByVal cn_fonttype As String, ByVal en_width As Integer, ByVal cn_width As Integer, ByVal pointwidth As Integer, ByVal pointheight As Integer, ByVal addvalue As String, _
ByVal space As Integer, ByVal bitmode As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_PrintMixTextEx(ByVal text As String, ByVal startx As Integer, ByVal en_starty As Integer, ByVal xy_adjust As Integer, ByVal rotate As Integer, ByVal en_fonttype As String, _
ByVal cn_fonttype As String, ByVal pointwidth As Integer, ByVal pointheight As Integer, ByVal addvalue As String, ByVal space As Integer, ByVal bitmode As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_PrintTruetype(ByVal text As String, ByVal startx As Integer, ByVal starty As Integer, ByVal fontname As String, ByVal fontheight As Integer, ByVal fontwidth As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_PrintImage(ByVal filename As String, ByVal startx As Integer, ByVal starty As Integer, ByVal bitmode As Integer) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_PrintBarcode(ByVal codedata As String, ByVal startx As Integer, ByVal starty As Integer, ByVal rotate As Integer, ByVal bartype As Integer, ByVal height As Integer, _
ByVal number As Integer, ByVal numberbase As Integer, ByVal addvalue As String) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_PrintPDF(ByVal codedata As String, ByVal startx As Integer, ByVal starty As Integer, ByVal rotate As Integer, ByVal basewidth As Integer, ByVal baseheight As Integer, _
ByVal scalewidth As Integer, ByVal scaleheight As Integer, ByVal row As Integer, ByVal column As Integer, ByVal cutmode As Integer, ByVal level As Integer, _
ByVal length As Integer, ByVal addvalue As String) As Integer
End Function
<DllImport("BPLADLL.dll")> _
Public Shared Function BPLA_CheckStatus(ByVal papershort As Byte(), ByVal ribbionshort As Byte(), ByVal busy As Byte(), ByVal pause As Byte(), ByVal com As Byte(), ByVal headheat As Byte(), _
ByVal headover As Byte(), ByVal cut As Byte()) As Integer
End Function
End Class
End Namespace
晓轩 2009-02-26
  • 打赏
  • 举报
回复
- -!!
wuyq11 2009-02-26
  • 打赏
  • 举报
回复
http://www.developerfusion.com/tools/convert/csharp-to-vb/

16,555

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧