可以的。我有全部的解决方案。可以看看 blog.eeworld.net/tayosoft
class CEPRINT
{
public struct DEFAULT
{
static public short DMORIENT_PORTRAIT = 1;
static public short DMORIENT_LANDSCAPE = 2;
static public short DMPAPER_LETTER = 1;
static public short DMPAPER_LEGAL = 5;
static public short DMPAPER_A4 = 9;
static public short DMPAPER_B4 = 12;
static public short DMPAPER_B5 = 13;
static public short DMRES_DRAFT = -1;
static public short DMRES_HIGH = -4;
static public short DMCOLOR_MONOCHROME = 1;
static public short DMCOLOR_COLOR = 2;
};
///
/// 首先必须调用这个函数后其它的函数才有效。否则出错
///
///
[DllImport("CEPRINT.DLL", EntryPoint = "CE_ShowPrintDialog")]
public static extern bool ShowPrintDialog();
/*
[DllImport("CEPRINT.DLL", EntryPoint = "CE_StartPrint")]
public static extern bool StartPrint();
[DllImport("CEPRINT.DLL", EntryPoint = "CE_StopPrint")]
public static extern bool StopPrint();
[DllImport("CEPRINT.DLL", EntryPoint = "CE_ExitPrint")]
public static extern bool ExitPrint();
*/
[DllImport("CEPRINT.DLL", EntryPoint = "CE_PrintImage")]
public static extern bool PrintImage(IntPtr hdc, UInt32 nStartX, UInt32 nStartY, UInt32 nWidth, UInt32 nHeight);
[DllImport("CEPRINT.DLL", EntryPoint = "CE_GetPrintName")]
public static extern bool GetPrintName(StringBuilder strPrintBuffer, int size);
[DllImport("CEPRINT.DLL", EntryPoint = "CE_GetPortName")]
public static extern string GetPortName(StringBuilder strPortBuffer, int size);
[DllImport("CEPRINT.DLL", EntryPoint = "CE_GetOrientation")]
public static extern short GetOrientation();
[DllImport("CEPRINT.DLL", EntryPoint = "CE_GetPapersize")]
public static extern short GetPapersize();
[DllImport("CEPRINT.DLL", EntryPoint = "CE_GetPrintQuality")]
public static extern short GetPrintQuality();
[DllImport("CEPRINT.DLL", EntryPoint = "CE_GetColor")]
public static extern short GetColor();
}
详情回复
发表于 2007-7-12 10:49
可以的。我有全部的解决方案。可以看看 blog.eeworld.net/tayosoft
class CEPRINT
{
public struct DEFAULT
{
static public short DMORIENT_PORTRAIT = 1;
static public short DMORIENT_LANDSCAPE = 2;
static public short DMPAPER_LETTER = 1;
static public short DMPAPER_LEGAL = 5;
static public short DMPAPER_A4 = 9;
static public short DMPAPER_B4 = 12;
static public short DMPAPER_B5 = 13;
static public short DMRES_DRAFT = -1;
static public short DMRES_HIGH = -4;
static public short DMCOLOR_MONOCHROME = 1;
static public short DMCOLOR_COLOR = 2;