Q
qddmh
Unregistered / Unconfirmed
GUEST, unregistred user!
我将打印机设置为A4纸,测试结果如下,是否有问题?
{
这一段是在论坛中找的, 就是获得纸张大小
function GetPixelsPerInchX: Integer;
begin
Result := GetDeviceCaps(Printer.Handle, LOGPIXELSX)
end;
function GetPixelsPerInchY: Integer;
begin
Result := GetDeviceCaps(Printer.Handle, LOGPIXELSY)
end;
function GetPageWidth: Integer;
begin
Result := Screen.PixelsPerInch*GetDeviceCaps(Printer.Handle, PHYSICALWIDTH) div GetPixelsPerInchX;
end;
function GetPageHeight: Integer;
begin
Result := Screen.PixelsPerInch*GetDeviceCaps(Printer.Handle, PHYSICALHEIGHT) div GetPixelsPerInchY;
end;
}
1,我用Showmessage(inttostr(GetPageWidth)+ '///' + inttostr(GetPageHeight));
结果为:793, 1122
2,Showmessage(inttostr(Printer.PageWidth) + '///' + inttostr(Printer.PageHeight));
结果为:4661, 6716
3,Showmessage(inttostr(GetDeviceCaps(Printer.Handle, PHYSICALWIDTH)) + '///' + inttostr(GetDeviceCaps(Printer.Handle, PHYSICALHEIGHT)));
结果为:4961, 7016
我是把纸设成A4怎会出现这些数字呢?
还有这几个不都是求得纸张大小码, 为何数值不同???
望速解答,谢谢!
{
这一段是在论坛中找的, 就是获得纸张大小
function GetPixelsPerInchX: Integer;
begin
Result := GetDeviceCaps(Printer.Handle, LOGPIXELSX)
end;
function GetPixelsPerInchY: Integer;
begin
Result := GetDeviceCaps(Printer.Handle, LOGPIXELSY)
end;
function GetPageWidth: Integer;
begin
Result := Screen.PixelsPerInch*GetDeviceCaps(Printer.Handle, PHYSICALWIDTH) div GetPixelsPerInchX;
end;
function GetPageHeight: Integer;
begin
Result := Screen.PixelsPerInch*GetDeviceCaps(Printer.Handle, PHYSICALHEIGHT) div GetPixelsPerInchY;
end;
}
1,我用Showmessage(inttostr(GetPageWidth)+ '///' + inttostr(GetPageHeight));
结果为:793, 1122
2,Showmessage(inttostr(Printer.PageWidth) + '///' + inttostr(Printer.PageHeight));
结果为:4661, 6716
3,Showmessage(inttostr(GetDeviceCaps(Printer.Handle, PHYSICALWIDTH)) + '///' + inttostr(GetDeviceCaps(Printer.Handle, PHYSICALHEIGHT)));
结果为:4961, 7016
我是把纸设成A4怎会出现这些数字呢?
还有这几个不都是求得纸张大小码, 为何数值不同???
望速解答,谢谢!