FastReport steals focus from other apps

edited 6:22PM in FastReport .NET
We have developed a PrintServer that is using FastReport. The PrintServer loads a FastReport file and a lot of XML data files and prints it to a printer.

The PrintServer is running in the taskbar. The problem is that when the funtion PrintPrepared is executed the application that does have focus (for example Word) looses focus for a second, for every print. That is very annoying. It makes it impossible to use the PC for other applications while FastReport is busy with printing.
How do I prevent that FastReport steals the focus from other apps?

I have already set the ShowProgress to false, before the PrintPrepared:
Config.ReportSettings.ShowProgress = false;

When I remark the line PrintPrepared the PrintServer did not steale the focus anymore. But, that is not what we wanted ;-)

Tia
Hans

Using version 1.3.51.

Comments

  • edited March 2010
    Hello,

    Once you have disabled the progress window, there will be no more UI operations that may steal the focus. Try to replace PrintPrepared call with the following code (prints a test page on a default printer, using the standard printing means also used in FastReport):
    using System.Drawing.Printing;
    
    using (PrintDocument doc = new PrintDocument())
    {
      doc.PrintController = new StandardPrintController();
      doc.PrintPage += new PrintPageEventHandler(doc_PrintPage);
      doc.Print();
    }
    
    void doc_PrintPage(object sender, PrintPageEventArgs e)
    {
      e.Graphics.DrawRectangle(Pens.Black, new Rectangle(20, 20, 200, 200));
      e.Graphics.DrawString("test", new Font("Arial", 10), Brushes.Black, new PointF(40, 40));
      e.HasMorePages = false;
    }
    

    If this code steals the focus too, we will not be able to fix this issue.
  • edited 6:22PM

    Problem seems to be in a printer that is used for ActiveFax.
    When I print the reports to a normal printer focus is not stolen.

    Thanks for your help.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.