DWORD DrawBarcode(HDC DC,WCHAR * Text,WCHAR * Text,WCHAR * StartStopChar,WCHAR * FaceName,WCHAR * Buffer,RECT * Bounds,RECT * BarcodeMatrix,Int TextWidth,Int TextHeight,int TextToBarcode,int TextQuietZone,int BarInflate,DWORD Color,DWORD Params);更详细的说明在http://download.csdn.net/source/3406957我想在C#中调用,请帮忙解决,需代码,成功结决再加分.
DWORD DrawBarcode(HDC DC,WCHAR * Text,WCHAR * Text,WCHAR * StartStopChar,WCHAR * FaceName,WCHAR * Buffer,RECT * Bounds,RECT * BarcodeMatrix,Int TextWidth,Int TextHeight,int TextToBarcode,int TextQuietZone,int BarInflate,DWORD Color,DWORD Params);更详细的说明在http://download.csdn.net/source/3406957我想在C#中调用,请帮忙解决,需代码,成功结决再加分.
WCHAR* -> string
RECT* -> ref Rectangle
Int -> int
DWORD -> uint
[DllImportAttribute("楼猪的DLL.DLL",EntryPoint="DrawBarcode")]
uint DrawBarcode(IntPtr DC,string Text,string Text,string StartStopChar,string FaceName,string Buffer,ref Rectangle Bounds,ref Rectangle BarcodeMatrix,Int TextWidth,Int TextHeight,int TextToBarcode,int TextQuietZone,int BarInflate,uint Color,uint Params);
/// <summary>
/// 使用前先构造 RECT rect = new RECT();
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
/// <summary>
///
/// </summary>
public int Left;
/// <summary>
///
/// </summary>
public int Top;
/// <summary>
///
/// </summary>
public int Right;
/// <summary>
///
/// </summary>
public int Bottom;
}
[DllImport("xxx.dll", EntryPoint = "DrawBarcode")]
public static extern uint DrawBarcode(
IntPtr hdc,
string Text, // 如果这WCHAR*参数是In类型,请用StringBuilder代替
string Text1,
string StartStopChar,
string FaceName,
string Buffer,
ref RECT Bounds,
ref RECT BarcodeMatrix,
int TextWidth,
int TextHeight,
int TextToBarcode,
int TextQuietZone,
int BarInflate,
uint Color,//这个用。Net的Color.ToArgb();方法获取,或者自己做位移都行
uint Params); //高度怀疑这个参数可能是32位指针类型,可用IntPtr代替。
写错了:string Text, // 如果这WCHAR*参数是In类型,请用StringBuilder代替string Text, // 如果这WCHAR*参数是Out输出类型,请用StringBuilder代替