W
wpghy
Unregistered / Unconfirmed
GUEST, unregistred user!
您好!我想编写一个连续打印贴纸的小程序, 不需要换页, 为什麽按以下程序只能打印一个, 而不能连续打印. 请您给于帮助,本人不盛感激,谢谢!
procedure TPlabel.BitBtn1Click(Sender: TObject);
var
i,n,pageNum:integer;
p_date:string;
begin
if inpudate.text<>'' then
p_date:=inpudate.text
else
p_date:=formatdatetime('yyyy/mm/dd',date);
if edit.text<>'' then
pageNum:=strToint(edit.text)
else
pageNum:=0;
if pageNum=0 then
begin
MessageBeep(0);
if messagedlg('打印份数为空, 是否退出打印? ',mtconfirmation,[mbYes,mbNo],0)=mrYes then
plabel.Close
else
edit.SetFocus;
end
else
if printdialog.Execute then
begin
n:=printer.PageHeight;
n:=n div 60;
printer.begin
Doc;
//pageNum: 是要打印的数量, p_date: 是要打印的内容.
for i:=0 to pageNum-1do
printer.Canvas.TextOut(13,i+n,p_date);
printer.enddoc;
end;
end;
procedure TPlabel.BitBtn1Click(Sender: TObject);
var
i,n,pageNum:integer;
p_date:string;
begin
if inpudate.text<>'' then
p_date:=inpudate.text
else
p_date:=formatdatetime('yyyy/mm/dd',date);
if edit.text<>'' then
pageNum:=strToint(edit.text)
else
pageNum:=0;
if pageNum=0 then
begin
MessageBeep(0);
if messagedlg('打印份数为空, 是否退出打印? ',mtconfirmation,[mbYes,mbNo],0)=mrYes then
plabel.Close
else
edit.SetFocus;
end
else
if printdialog.Execute then
begin
n:=printer.PageHeight;
n:=n div 60;
printer.begin
Doc;
//pageNum: 是要打印的数量, p_date: 是要打印的内容.
for i:=0 to pageNum-1do
printer.Canvas.TextOut(13,i+n,p_date);
printer.enddoc;
end;
end;