procedure TCusBasic.QuickRep1StartPage(Sender: TCustomQuickRep);
var i,j,leftmargin,rowheight,colwidth:integer;
begin
leftmargin:=120;
i:=0;
colwidth:=100;
with QuickRep1.QRPrinter.Canvas do
begin
Font.Name:='Arial';
Font.Size:=11;
rowheight:=Font.Height+35;
with QryCusBasicForm.ADOQuery2 do
begin
first;
while not eof do
begin
for j:=0 to 2 do
begin
if not eof then
begin
textout(leftmargin+j*colwidth+5,400+i*rowheight,FieldValues['主叫号码']);
next;
end;
end;
i:=i+1;
end;
textout(leftmargin,400+i*rowheight,'主叫号码总数: '+Inttostr(recordcount));
end;
end;
//
leftmargin:=400+60;
i:=0;
colwidth:=200;
with QuickRep1.QRPrinter.Canvas do
begin
Font.Name:='Arial';
Font.Size:=11;
rowheight:=Font.Height+35;
with QryCusBasicForm.ADOQuery3 do
begin
first;
while not eof do
begin
textout(leftmargin,400+i*rowheight,FieldValues['设备名称']);
textout(leftmargin+colwidth,400+i*rowheight,inttostr(FieldValues['设备数量'])+'台');
next;
i:=i+1;
end;
textout(leftmargin,400+i*rowheight,'设备总数: '+Inttostr(recordcount)+'台');
end;
end;
end;
为什么打印出来的东西总是在左手方,但是,预览的时候是正确的,而且似乎后面的覆盖了前面的,我怀疑上不同设备比例上的问题,郁闷!
var i,j,leftmargin,rowheight,colwidth:integer;
begin
leftmargin:=120;
i:=0;
colwidth:=100;
with QuickRep1.QRPrinter.Canvas do
begin
Font.Name:='Arial';
Font.Size:=11;
rowheight:=Font.Height+35;
with QryCusBasicForm.ADOQuery2 do
begin
first;
while not eof do
begin
for j:=0 to 2 do
begin
if not eof then
begin
textout(leftmargin+j*colwidth+5,400+i*rowheight,FieldValues['主叫号码']);
next;
end;
end;
i:=i+1;
end;
textout(leftmargin,400+i*rowheight,'主叫号码总数: '+Inttostr(recordcount));
end;
end;
//
leftmargin:=400+60;
i:=0;
colwidth:=200;
with QuickRep1.QRPrinter.Canvas do
begin
Font.Name:='Arial';
Font.Size:=11;
rowheight:=Font.Height+35;
with QryCusBasicForm.ADOQuery3 do
begin
first;
while not eof do
begin
textout(leftmargin,400+i*rowheight,FieldValues['设备名称']);
textout(leftmargin+colwidth,400+i*rowheight,inttostr(FieldValues['设备数量'])+'台');
next;
i:=i+1;
end;
textout(leftmargin,400+i*rowheight,'设备总数: '+Inttostr(recordcount)+'台');
end;
end;
end;
为什么打印出来的东西总是在左手方,但是,预览的时候是正确的,而且似乎后面的覆盖了前面的,我怀疑上不同设备比例上的问题,郁闷!
1、你可以先把打印文件绘制到一个Windows元文件中。然后再绘制到打印机上。
2、使用GetDeviceCaps和LOGPIXELSX以及LOGPIXELSY参数来取得设备的逻辑英寸(也就是dpi)。然后调整你的缩进大小。
begin
Result := GetDeviceCaps(QuickRep1.Printer.Handle, LOGPIXELSY)
end;
系统提示handle有错,why
不过,如果你总是使用当前打印机的话,就直接调用Printer.handle吧。