Home Forums WinForms controls Xceed Grid for WinForms How to show print preview dialog at the center of screen?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15669 |

    How to show print preview dialog at the center of screen?

    When printing grid control

    Report report = new Report(grid);
    PrinterSettings printerSettings = new PrinterSettings();
    report.PrintPreview(printerSettings);

    Imported from legacy forums. Posted by Fedir (had 2696 views)

    Xceed Support
    Member
    Post count: 5658

    You cannot directly do it with the Report class.

    However, you can do it if create your own PrintPreviewDialog using the StartPosition property.

    <code>
    Report report = new Report( gridControl1 );
    PrintPreviewDialog ppDialog = new PrintPreviewDialog();
    ppDialog.Document = report.CreatePrintDocument();

    ppDialog.Left = 0;
    ppDialog.Top = 0;
    ppDialog.Width = 800;
    ppDialog.Height = 600;
    ppDialog.FindForm().StartPosition = FormStartPosition.CenterScreen;

    ppDialog.ShowDialog();
    </code>

    The StartPosition property is also exposed on the GenerateReportForm:

    <code>
    using( GenerateReportForm generateReportForm = new GenerateReportForm( this.gridControl1 ) )
    {
    generateReportForm.StartPosition = FormStartPosition.CenterScreen;
    generateReportForm.ShowDialog();
    }
    </code>

    Imported from legacy forums. Posted by CharlesB (had 948 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks a lot.

    Imported from legacy forums. Posted by Fedir (had 3519 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.