We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Zoom in PrintPreview

Thread ID:





20642 Oct 21,2004 08:58 PM UTC Oct 22,2004 05:48 AM UTC WinForms 2
Tags: GridControl
Madhavi Balusu
Asked On October 21, 2004 08:58 PM UTC

Hi, I would like to set the size of the preview dilaog (PrintPreviewDialog) to the size of the application''s main window and zoom it to 100%. How do I do that?

Madhavi Balusu
Replied On October 21, 2004 09:08 PM UTC

I use C# BTW. Thx.

Administrator [Syncfusion]
Replied On October 22, 2004 05:48 AM UTC

The PrintPreviewDialog is a .Net Framework form, so you would use the same techniques to size and position it as you would with any form. To set the zoom factor, this is also a .Net Framework process. You somehow have to get the PrintPreviewControl that is embedded in the PrintPreviewDialog and set some properties on that object. Below is code that worked for me. There may be better ways of doing this.
private void button1_Click(object sender, System.EventArgs e)
	GridDataBoundGrid grid = this.gridDataBoundGrid1;
	GridPrintDocument pd = new GridPrintDocument(grid, true);  
	PrintPreviewDialog dlg = new PrintPreviewDialog();
	dlg.Document = pd;
	dlg.Bounds = new Rectangle(0, 0, grid.Width, grid.Height);
	Point gridLoc = grid.Location;
	Point pt = this.gridDataBoundGrid1.PointToScreen(gridLoc);
	dlg.SetDesktopLocation(pt.X - gridLoc.X, pt.Y - gridLoc.Y);
	dlg.StartPosition = FormStartPosition.Manual;
	PrintPreviewControl ppc = null;
	foreach(Control c in dlg.Controls)
		if(c is PrintPreviewControl)
			ppc = c as PrintPreviewControl;
			ppc.AutoZoom = true;
			ppc.Zoom = 1;


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon