Delphi 选择指定打印机的方法《LceMeaning》

以下代码经本人Delphi XE2下编写并通过

          case Sysconfig.ReadInteger('Printer','IsPrint',0) of
            0:
              begin
                 if Sysconfig.ReadBool('Printer','Spending',False) then
                   begin
                     if MessageBox(Handle, PChar('是否打印消费单据?                                          '),
                       PChar('打印'), MB_ICONINFORMATION or MB_YESNO or MB_DEFBUTTON1) = IDYES then
                         begin
                           goto GoToS;
                         end;
                   end;
              end;
            1:
              begin
                GoToS :
                if Sysconfig.ReadBool('Printer','Spending',False) then
                   begin
                      frxReport1.Clear;
                      frxReport1.LoadFromFile('ReportMConsumer.fr3');
                      //frxReport1.ShowReport();
                      frxReport1.PrepareReport;
                      frxReport1.PrintOptions.ShowDialog := False;
                      frxReport1.PrintOptions.Printer := PrintName;  //此处一定要用变量
                      frxReport1.PrintOptions.Copies := Sysconfig.ReadInteger('Printer','SpendingCopies',1);
                      frxReport1.Print;
                   end;
              end;
          end;
原文地址:https://www.cnblogs.com/LceMeaning/p/3503296.html