X
xz5895
Unregistered / Unconfirmed
GUEST, unregistred user!
Function addpage():Boolean;
//添加一打印纸张类型名称为300k
var
FormInfo: TFormInfo1;
PaperSize: TSize;
PaperRect: TRect;
begin
FormInfo.Flags := FORM_USER;
FormInfo.pName := PChar('300k');
PaperSize.cx := 100000;
PaperSize.cy := 100000;
//300k纸张的默认大小 1000mm*1000mm
PaperRect.Left := 1;
PaperRect.Top := 1;
PaperRect.Right := 100000;
PaperRect.Bottom := 100000;
//纸张的边距
FormInfo.Size := PaperSize;
FormInfo.ImageableArea := PaperRect;
AddForm(hPrinter, 1, @FormInfo);
Result := True;
end;
Function changepape():Boolean;
//改变当前的打印纸张设置
var
FormInfos : Array [1..1024] of Form_Info_1;
cbNeeded, cReturned ,neededsize: DWORD;
i,j:integer;
ppoRINTER_INFO_2;
dev DeviceMode;
begin
EnumForms(hPrinter, 1, Nil, 0, cbNeeded, cReturned);
EnumForms(hPrinter, 1, @FormInfos, cbNeeded, cbNeeded, cReturned );
j := 0;
for i:= 1 to cReturned do
通过轮寻找到300k的纸张的纸张类型排序号
if FormInfos.pName = '300k' then
j:=i;
if j=0 then
begin
addpage();
j := cReturned + 1;
end;
//如无300k纸张则添加
GetPrinter(hPrinter,2,Nil, 0, @NeededSize);
GetPrinter(hPrinter, 2, @ppo, NeededSize, @NeededSize);
dev := ppo.pDevMode;
dev.dmPaperSize := j;
ppo.pDevMode := dev;
SetPrinter(hPrinter,2,@ppo,0);
//定义打印机列表并选择300k纸张
Result := True;
end;
//添加一打印纸张类型名称为300k
var
FormInfo: TFormInfo1;
PaperSize: TSize;
PaperRect: TRect;
begin
FormInfo.Flags := FORM_USER;
FormInfo.pName := PChar('300k');
PaperSize.cx := 100000;
PaperSize.cy := 100000;
//300k纸张的默认大小 1000mm*1000mm
PaperRect.Left := 1;
PaperRect.Top := 1;
PaperRect.Right := 100000;
PaperRect.Bottom := 100000;
//纸张的边距
FormInfo.Size := PaperSize;
FormInfo.ImageableArea := PaperRect;
AddForm(hPrinter, 1, @FormInfo);
Result := True;
end;
Function changepape():Boolean;
//改变当前的打印纸张设置
var
FormInfos : Array [1..1024] of Form_Info_1;
cbNeeded, cReturned ,neededsize: DWORD;
i,j:integer;
ppoRINTER_INFO_2;
dev DeviceMode;
begin
EnumForms(hPrinter, 1, Nil, 0, cbNeeded, cReturned);
EnumForms(hPrinter, 1, @FormInfos, cbNeeded, cbNeeded, cReturned );
j := 0;
for i:= 1 to cReturned do
通过轮寻找到300k的纸张的纸张类型排序号
if FormInfos.pName = '300k' then
j:=i;
if j=0 then
begin
addpage();
j := cReturned + 1;
end;
//如无300k纸张则添加
GetPrinter(hPrinter,2,Nil, 0, @NeededSize);
GetPrinter(hPrinter, 2, @ppo, NeededSize, @NeededSize);
dev := ppo.pDevMode;
dev.dmPaperSize := j;
ppo.pDevMode := dev;
SetPrinter(hPrinter,2,@ppo,0);
//定义打印机列表并选择300k纸张
Result := True;
end;