Fosdccf.blog.chinaunix.net
sdccf
全部博文(19283)
Linux酷软(214)
tmp(0)
PostgreSQL(93)
Solaris(383)
AIX(173)
SCOUNIX(575)
DB2(1005)
Shell(386)
C/C++(1187)
MySQL(1750)
Sybase(465)
Oracle(3695)
Informix(548)
HP-UX(0)
IBM AIX(2)
Sun Solaris(0)
BSD(1)
Linux(8597)
SCO UNIX(23)
2011年(1)
2009年(125)
2008年(19094)
2007年(63)
clifford
linky521
曾德标
fengzhan
leon_yu
mcuflowe
yt200902
guanyuji
GY123456
snow888
carlos94
丸喵喵
sean229
cxunix
可怜的猪
cqxc413
xzzgege
wb123456
分类: C/C++
2008-04-16 19:06:26
因网上只有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(); }
因网上只有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(); }
上一篇:拓展网页技术之C++在网页设计中的应用
下一篇:C++Builder创建基于Internet点对点Chat
登录 注册