打印时的页边距 在程序中,如何得到默认打印机的页边距?既打印纸左侧和顶部距第一个可打印字符的最小距离。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 获取打印页边距 uses Printers; procedure TForm1.Button1Click(Sender: TObject); var EscapeCode : integer; Margin : TPoint; begin if PrintDialog1.Execute then begin {$IFDEF WIN32} Margin.x :=GetDeviceCaps(Printer.Handle, PHYSICALOFFSETX); Margin.y :=GetDeviceCaps(Printer.Handle, PHYSICALOFFSETY); {$ELSE} EscapeCode := GETPRINTINGOFFSET; if Escape(Printer.Handle, QUERYESCSUPPORT, sizeof(EscapeCode), @EscapeCode, nil) <> 0 then if Escape(Printer.Handle, GETPRINTINGOFFSET, 0, nil, @Margin) < 1 then begin EscapeCode := GETPHYSPAGESIZE; if Escape(Printer.Handle, QUERYESCSUPPORT, sizeof(EscapeCode), @EscapeCode, nil) <> 0 then if Escape(Printer.Handle, GETPHYSPAGESIZE, 0, nil, @Margin) > 0 then begin Margin.x := (Margin.x - GetDeviceCaps(Printer.Handle, HorzRes)) div 2; Margin.y := (Margin.y - GetDeviceCaps(Printer.Handle, VertRes)) div 2; end else begin Margin.x := 0; Margin.y := 0; end; end; {$ENDIF} Memo1.Lines.Add(IntToStr(Margin.x)); Memo1.Lines.Add(IntToStr(Margin.y)); end; end; quickrep1.left(top right bottom) delphi 播放flash 新手急求多线程解决方案。送上50分! [散分贴]mm们进来接分 delphi ——用ADOCOMMAND 动态创建触发器 哪里有Delphi7下载呀? 关于类声明用的可见性表示符小问题,请大家帮忙解答一下吧. 出现必须加载Dll的错误怎么办?????????????? 如何去掉W2000server登录时的窗口?在线等!立即给分! 超级简单,就是没的出来!!! 追了半年的她回家過了個春節就給訂婚了,大家說說我該怎么辦? 郁闷啊,,,,, 打印問題 !!
var
EscapeCode : integer;
Margin : TPoint;
begin
if PrintDialog1.Execute then begin
{$IFDEF WIN32}
Margin.x :=GetDeviceCaps(Printer.Handle, PHYSICALOFFSETX);
Margin.y :=GetDeviceCaps(Printer.Handle, PHYSICALOFFSETY);
{$ELSE}
EscapeCode := GETPRINTINGOFFSET;
if Escape(Printer.Handle,
QUERYESCSUPPORT,
sizeof(EscapeCode),
@EscapeCode,
nil) <> 0 then
if Escape(Printer.Handle,
GETPRINTINGOFFSET,
0,
nil,
@Margin) < 1 then begin
EscapeCode := GETPHYSPAGESIZE;
if Escape(Printer.Handle,
QUERYESCSUPPORT,
sizeof(EscapeCode),
@EscapeCode,
nil) <> 0 then
if Escape(Printer.Handle,
GETPHYSPAGESIZE,
0,
nil,
@Margin) > 0 then begin
Margin.x := (Margin.x -
GetDeviceCaps(Printer.Handle, HorzRes)) div 2;
Margin.y := (Margin.y -
GetDeviceCaps(Printer.Handle, VertRes)) div 2;
end else begin
Margin.x := 0;
Margin.y := 0;
end;
end;
{$ENDIF}
Memo1.Lines.Add(IntToStr(Margin.x));
Memo1.Lines.Add(IntToStr(Margin.y));
end;
end;