M
mosane
Unregistered / Unconfirmed
GUEST, unregistred user!
if printdialog1.Execute then
begin
Printer.Canvas.Font.Size := 9;
PointX := GetDeviceCaps(Printer.Handle, LOGPIXELSX);
PointY := GetDeviceCaps(Printer.Handle, LOGPIXELSY);
PrintX := Trunc(PointX / 72);
PrintY := Trunc(PointY / 72);
PrintStepY := Trunc(Printer.Canvas.TextHeight('字高') * PointY / 72);
Label1.Caption := IntToStr(Printer.Canvas.TextHeight('字高'));
Label3.Caption := IntToStr(PrintY);
Label4.Caption := IntToStr(PrintStepY);
if checkbox1.Checked then
begin
Printer.begin
Doc;
for i := 1 to 10do
begin
PrintY := PrintY + PrintStepY;
Printer.Canvas.TextOut(PrintX, PrintY, '中国人民站起来了。'+IntToStr(i));
end;
Printer.EndDoc;
end;
end;
就这么一段,都要出问题,如果没有勾上 checkbox1,也就没有真正打印的话,怎么改变了打印机的打印质量,Label1.Caption := IntToStr(Printer.Canvas.TextHeight('字高'));显示的值都是一样的,都是12;但如果真正打印了,改变了打印机的打印质量,也就是打印机的分辨率改变了,显示到的Label1.Caption就变来变去的,有12、45、15、90,乱来的,为什么?
begin
Printer.Canvas.Font.Size := 9;
PointX := GetDeviceCaps(Printer.Handle, LOGPIXELSX);
PointY := GetDeviceCaps(Printer.Handle, LOGPIXELSY);
PrintX := Trunc(PointX / 72);
PrintY := Trunc(PointY / 72);
PrintStepY := Trunc(Printer.Canvas.TextHeight('字高') * PointY / 72);
Label1.Caption := IntToStr(Printer.Canvas.TextHeight('字高'));
Label3.Caption := IntToStr(PrintY);
Label4.Caption := IntToStr(PrintStepY);
if checkbox1.Checked then
begin
Printer.begin
Doc;
for i := 1 to 10do
begin
PrintY := PrintY + PrintStepY;
Printer.Canvas.TextOut(PrintX, PrintY, '中国人民站起来了。'+IntToStr(i));
end;
Printer.EndDoc;
end;
end;
就这么一段,都要出问题,如果没有勾上 checkbox1,也就没有真正打印的话,怎么改变了打印机的打印质量,Label1.Caption := IntToStr(Printer.Canvas.TextHeight('字高'));显示的值都是一样的,都是12;但如果真正打印了,改变了打印机的打印质量,也就是打印机的分辨率改变了,显示到的Label1.Caption就变来变去的,有12、45、15、90,乱来的,为什么?