# include“l_bitmap.h”
L_LTDIS_APIL_INTnX L_PrintBitmapGDIPlus (hDC pBitmap, nY, nWidth, nHeight, uFlags)
打印位图使用GDI +到指定的设备上下文。
处理设备上下文(DC)位图是打印的地方。设备的映射模式必须MM_TEXT上下文。
位图句柄指针引用位图打印。
值代表了X位置开始打印。
值代表了Y位置开始打印。
值表示打印宽度,以像素为单位。实际的宽度取决于每英寸点数(DPI)的打印机。
值代表了印刷高度,以像素为单位。实际的高度取决于每英寸点数(DPI)的打印机。
保留以供将来使用。通过0。
价值 | 意义 |
---|---|
成功 | 函数是成功的。 |
< 1 | 一个错误发生。指返回代码。 |
如果GDI +库没有安装到系统,将返回一个错误代码。
必需的dll和库
x64 Win32。
这个例子中决定了输出尺寸适合半个页面上的图像,并打印位图在同一页的两倍。
L_INT PrintBitmapGDIPlusExample (L_VOID)
{
BITMAPHANDLE LeadBitmap;图片* / / *位图句柄
HDC PrinterDC;* / / * DC的打印机
L_INT WidthAllowed、HeightAllowed WidthFactor HeightFactor;/ * * /尺寸计算
L_INT PrintWidth PrintHeight;/ *打印图像的宽度和高度* /
L_INT nRet;
/ *加载位图的位/像素* /
nRet = L_LoadBitmap (MAKE_IMAGE_PATH(文本(“Image1.cmp”&LeadBitmap)),运算符(BITMAPHANDLE), 0 ORDER_BGR空,空);
如果(nRet ! =成功)
返回nRet;
/ *获取打印机直流* /
PrinterDC = L_PrintBitmapFast(空,空,0,0,0,0,假);
/ *初始化变量拟合图像半页* /
WidthAllowed = GetDeviceCaps (PrinterDC HORZRES);
HeightAllowed = GetDeviceCaps (PrinterDC VERTRES) * 4/10;
HeightFactor = BITMAPHEIGHT (&LeadBitmap);
WidthFactor = BITMAPWIDTH (&LeadBitmap);
/ *是否使用最大宽度会使图像太高* /
如果((L_INT) (((L_INT32) WidthAllowed * HeightFactor) / WidthFactor) < HeightAllowed)
{/ *使用最大宽度,计算出高度值* /
PrintWidth = WidthAllowed;
PrintHeight = (L_INT) (((L_INT32) PrintWidth * HeightFactor) / WidthFactor);
}
其他的
{/ *使用的最大高度,并计算宽度值* /
PrintHeight = HeightAllowed;
PrintWidth = (L_INT) (((L_INT32) PrintHeight * WidthFactor) / HeightFactor);
}
/ *打印第一个图片* /
nRet = L_PrintBitmapGDIPlus (PrinterDC &LeadBitmap 1, 1 PrintWidth PrintHeight, 0);
如果(nRet ! =成功)
返回nRet;
* / / *打印第二图像
nRet = L_PrintBitmapGDIPlus (PrinterDC &LeadBitmap 1, HeightAllowed * 6/5, PrintWidth, PrintHeight, 0);
如果(nRet ! =成功)
返回nRet;
EndPage (PrinterDC);
EndDoc (PrinterDC);
L_FreeBitmap (&LeadBitmap);
DeleteDC (PrinterDC);
返回成功;
}
帮助收藏
光栅net|C API|c++类库|HTML5 JavaScript
文档net|C API|c++类库|HTML5 JavaScript
医疗net|C API|c++类库|HTML5 JavaScript
医疗Web查看器net
188宝金博怎么下载
支持的平台上
net, Java, Android和iOS / macOS组件
C / c++类库的API
HTML5 JavaScript库
你的邮件已经发送到支持!有人应该联系!如果你的问题是紧急请回到聊天。
聊天时间:
周一——周五,上午6点等
谢谢你的反馈!
请填写表单重新开始一个新的聊天。
所有代理目前离线。
聊天时间:
周一-周五
早上8:30 - 6点
联系我们请填写这张表格,我们将通过电子邮件联系你。