-
c语言入门之C++Builder编程中动态更改自定义打印纸
因网上只有Delphi例子本人在用CB编写时发现有一些例子不能用,
所以一生气就索性查了查资料自己写了,怕网友们在用编程时也遇见此类情况,
就马上传了上来。
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
char *ADevice, *ADriver, *APort;
THandle DeviceMode;
PDeviceMode DevMode;
int length,width;
length=1400;
width=2410;//设定自定义纸张的尺寸单位为0.1毫米
ADevice =new char[100];
ADriver =new char[100];
APort =new char[100];
//获取打印机
Printer()->GetPrinter(ADevice, ADriver, APort,DeviceMode);
//获取PDevMode结构
DevMode =(_devicemodeA*) GlobalLock((void *)DeviceMode);
//设定可以修改的值
DevMode->dmFields = DevMode->dmFields|DM_PAPERSIZE;
DevMode->dmFields = DevMode->dmFields|DM_PAPERLENGTH;
DevMode->dmFields = DevMode->dmFields|DM_PAPERWIDTH;
//设定要修改的值
DevMode->dmPaperSize=DMPAPER_USER;//设为自定义纸张
DevMode->dmPaperLength=length;
DevMode->dmPaperWidth=width;
//测试打印
Printer()->BeginDoc();
TextOut(Printer()->Handle, 0, 0, "-----------------",17);
Printer()->NewPage();
TextOut(Printer()->Handle, 0, 0, "++++++++++++++++++",18);
Printer()->NewPage();
Printer()->EndDoc();
}
所以一生气就索性查了查资料自己写了,怕网友们在用编程时也遇见此类情况,
就马上传了上来。
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
char *ADevice, *ADriver, *APort;
THandle DeviceMode;
PDeviceMode DevMode;
int length,width;
length=1400;
width=2410;//设定自定义纸张的尺寸单位为0.1毫米
ADevice =new char[100];
ADriver =new char[100];
APort =new char[100];
//获取打印机
Printer()->GetPrinter(ADevice, ADriver, APort,DeviceMode);
//获取PDevMode结构
DevMode =(_devicemodeA*) GlobalLock((void *)DeviceMode);
//设定可以修改的值
DevMode->dmFields = DevMode->dmFields|DM_PAPERSIZE;
DevMode->dmFields = DevMode->dmFields|DM_PAPERLENGTH;
DevMode->dmFields = DevMode->dmFields|DM_PAPERWIDTH;
//设定要修改的值
DevMode->dmPaperSize=DMPAPER_USER;//设为自定义纸张
DevMode->dmPaperLength=length;
DevMode->dmPaperWidth=width;
//测试打印
Printer()->BeginDoc();
TextOut(Printer()->Handle, 0, 0, "-----------------",17);
Printer()->NewPage();
TextOut(Printer()->Handle, 0, 0, "++++++++++++++++++",18);
Printer()->NewPage();
Printer()->EndDoc();
}
最新更新
Objective-C语法之代码块(block)的使用
VB.NET eBook
Add-in and Automation Development In VB.NET 2003 (F
Add-in and Automation Development In VB.NET 2003 (8
Add-in and Automation Development in VB.NET 2003 (6
Add-in and Automation Development In VB.NET 2003 (5
AddIn Automation Development In VB.NET 2003 (4)
AddIn And Automation Development In VB.NET 2003 (2)
Addin and Automation Development In VB.NET 2003 (3)
AddIn And Automation Development In VB.NET 2003 (1)
2个场景实例讲解GaussDB(DWS)基表统计信息估
常用的 SQL Server 关键字及其含义
动手分析SQL Server中的事务中使用的锁
openGauss内核分析:SQL by pass & 经典执行
一招教你如何高效批量导入与更新数据
天天写SQL,这些神奇的特性你知道吗?
openGauss内核分析:执行计划生成
[IM002]Navicat ODBC驱动器管理器 未发现数据
初入Sql Server 之 存储过程的简单使用
SQL Server -- 解决存储过程传入参数作为s
武装你的WEBAPI-OData入门
武装你的WEBAPI-OData便捷查询
武装你的WEBAPI-OData分页查询
武装你的WEBAPI-OData资源更新Delta
5. 武装你的WEBAPI-OData使用Endpoint 05-09
武装你的WEBAPI-OData之API版本管理
武装你的WEBAPI-OData常见问题
武装你的WEBAPI-OData聚合查询
OData WebAPI实践-OData与EDM
OData WebAPI实践-Non-EDM模式