• 重置delphi Printer对象


    http://www.efg2.com/Lab/Library/UseNet/1999/0714b.txt

    From: "Nick Ryan" <nick@avatardesign.co.uk>
    Subject: Re: D1 printing problem: incorrect font sizes
    Date: 14 Jul 1999 00:00:00 GMT
    Message-ID: <7mi4cp$2ot9@forums.borland.com>
    References: <378C94B3.DFDF6FEB@bergsoft.de>
    X-Priority: 3
    X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
    Organization: Another Netscape Collabra Server User
    X-MSMail-Priority: Normal
    Newsgroups: borland.public.delphi.winapi,borland.public.delphi.objectpascal
    
    
    Daniel Berg (Berg Soft) <berg@bergsoft.de> wrote in message
    news:378C94B3.DFDF6FEB@bergsoft.de...
    > Hi there,
    >
    > I've got the following the following problem using D1 (on D2 and later
    > the problem does not occur)
    >
    >
    > I can select different printers with different resolutions from the
    > printdialog.我可以从打印机对话框里 选相应不同分辨率的不同打印机。
    > Printing to any printer works fine when the prog just started (i.e:
    > Printing to Printer1, then shutdown prog, run again, then print to
    > Printer 2 works perfect). 当程序刚启动时,打印到任何一个打印机都是正常的。比如打印到 打印机1,然后关闭程序。 再次运行,然后打印 到 打印机2,一起正常。
    >
    > Printing to a second printer AFTER printing to a first printer scales
    > all fonts by
    >
    > Resolution(Printer1)/resolution(Printer2);
    打印到第一个打印机后,(不关闭程序)直接再打印到第二个打印机时,缩放了所有的字体 以
    第一个打印机 分辨率 / 第二个打印机分辨率 的比例。
    > > I have already tried the following without success: > > - Creation of the form that uses the printers unit at runtime AFTER > printdialog.execute to create a new printer instance everytime > > - I have checked printers resolution with GetDeviceCaps: printer > change is recognized correctly. > > Does anyone has an idea of whats wrong? It's some weird bug in Delphi's TPrinter that causes information to be retained from a previous print session. (It affects the line thickness of printing using D3).

    这是打印机对象中的一些奇怪BUG。导致信息 从前一次打印会话中 保留。 The following code forces a complete refresh of the Printer object in D3 - it *should* work in D1 as well... procedure ResetTPrinter; var APrinter:TPrinter; begin if (not Printer.Printing) then begin APrinter := SetPrinter(NIL); if (APrinter <> NIL) then APrinter.Free; end; {if} end;
    //我看新版的VCL源代码里直接 一行代码 就行了 SetPrinter(nil).Free; Nick


  • 相关阅读:
    php环境搭建工具包推荐
    Android视频直播解决方案(rstp、udp)
    软件版本号命名
    附加数据库失败,无法升级数据库,因为它是只读的
    Web Api如何传递POST请求
    找回Reshaprer的Alt+Enter快捷键的方法
    asp.net 实现在线打印功能,jQuery打印插件PrintArea实现自动分页
    asp.net 回发或回调参数无效的各种情况分析及解决办法
    MQTT, XMPP, WebSockets还是AMQP?泛谈实时通信协议选型 good
    echarts 专题
  • 原文地址:https://www.cnblogs.com/CodeGear/p/4177025.html
Copyright © 2020-2023  润新知