///////////////////////////////////////////////// ///////////////////
// wuhan Explore Computer Studio //
//http://tansuo.51.net//
///////////////////////////////////////////////// ///////////////////
//追加して、ペーパー仕様をカスタマイズします
// Papername:カスタムペーパー名
// PaperWidth:0.1mmの単位での紙の幅
// PaperLength:紙の高さ、0.1mmの単位単位
proceduretdm.adddcustompaper(constpapername:string; paperwidth、paperlength:integer);
var
printdevice、printdriver、printport:array [0..255] ofchar;
hdmode:thandle;
hprinter:thandle;
forminfo:tforminfo1;
始める
printer.getPrinter(printdevice、printdriver、printport、hdmode);
OpenPrinter(printDevice、hprinter、nil);
ifhprinter = 0then
raiseexception.create( 'プリンターの結合が失敗!');
withforminfodo
始める
フラグ:= form_user;
pname:= pchar(papername);
size.cx := paperwidth*100;
size.cy := paperlength*100;
ImageAblEarea.Left:= 0;
ImageablEarea.top:=0;
ImageAblEarea.right:= PaperWidth*100;
ImageAblEarea.Bottom:= PaperLength*100;
終わり;
//ペーパータイプを変更しない場合は、新しいものを追加します
ifnotesetform(hprinter、pchar(papername)、1、@forminfo)
addform(hprinter、1、@forminfo);
ClosePrinter(hprinter);
終わり;
//カスタム仕様ペーパーを削除します
// Papername:カスタムペーパー名
proceduretdm.deleteCustompaper(constapapername:string);
var
printDevice、printdriver、printport:array [0..255] ofchar;
hdmode:thandle;
hprinter:thandle;
始める
printer.getPrinter(printdevice、printdriver、printport、hdmode);
OpenPrinter(printDevice、hprinter、nil);
ifhprinter = 0then
raiseexception.create( 'プリンターの結合が失敗!');
deleteform(hprinter、pchar(papername));
ClosePrinter(hprinter);
終わり;