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

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)