uses printers
ppix, ppiy: Integer;
procedure Getppi(DC: HDC);
begin
ppix := GetDeviceCaps(DC, logPixelsX);
ppiy := GetDeviceCaps(DC, logPixelsY);
end;function CmToPixelX(cm: Real): Integer;
begin
Result := Trunc(Cm * ppix / 2.54);
end;function CmToPixelY(cm: Real): integer;
begin
Result := Trunc(Cm * ppiy /2.54);
end;
/////////////////////////////////////////
printer.BeginDoc;
printer.Canvas.Font.Size:=12;
printer.Canvas.TextOut(CmToPixelX(12),CmToPixelY(14),'你好');
printer.EndDoc;这样对吗?
ppix, ppiy: Integer;
procedure Getppi(DC: HDC);
begin
ppix := GetDeviceCaps(DC, logPixelsX);
ppiy := GetDeviceCaps(DC, logPixelsY);
end;function CmToPixelX(cm: Real): Integer;
begin
Result := Trunc(Cm * ppix / 2.54);
end;function CmToPixelY(cm: Real): integer;
begin
Result := Trunc(Cm * ppiy /2.54);
end;
/////////////////////////////////////////
printer.BeginDoc;
printer.Canvas.Font.Size:=12;
printer.Canvas.TextOut(CmToPixelX(12),CmToPixelY(14),'你好');
printer.EndDoc;这样对吗?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货