Posted 31 January 2019, 11:00 pm EST
Hello
I am testing the spread for windows forms 12. My question is, can the size of the preview be maximized to the size of the monitor? I see that the default size is small.
Thanks
Forums Home / Spread / Spread for WinForms
Posted by: j_asimbaya on 31 January 2019, 11:00 pm EST
Posted 31 January 2019, 11:00 pm EST
Hello
I am testing the spread for windows forms 12. My question is, can the size of the preview be maximized to the size of the monitor? I see that the default size is small.
Thanks
Posted 1 February 2019, 6:43 am EST
Hello,
I am not sure what do you actually mean by the “size of the preview”.
If in case you are referring to the size of the Spread control while adding it to the form then you can anytime resize the control size maximum to the size of the form by docking it in the form.
And further if you want the form preview to be maximized when you run the application then use this code in Form1_Load event:-
this.WindowState = FormWindowState.Maximized;
Hope it helps. Else please clarify what do you actually mean and refer by the term “preview”. We will look into the same thereon.
Thanks,
Reeva
Posted 5 February 2019, 12:11 pm EST - Updated 30 September 2022, 2:00 pm EST
Hello,
Yes, I think I lacked clarity on the subject. I mean Print Preview.
This is the code I am using:
fpSpread.ActiveSheet.PrintInfo.ShowColumnHeaders = chkShowCol.Checked;
fpSpread.ActiveSheet.PrintInfo.ShowRowHeaders = chkShowRow.Checked;
fpSpread.ActiveSheet.PrintInfo.ShowGrid = chkShowGrid.Checked;
fpSpread.ActiveSheet.PrintInfo.ShowBorder = chkShowBorder.Checked;
fpSpread.ActiveSheet.PrintInfo.ShowShadows = chkShowShadow.Checked;
fpSpread.ActiveSheet.PrintInfo.ShowColor = chkShowColor.Checked;
fpSpread.ActiveSheet.PrintInfo.UseMax = chkShowData.Checked;
fpSpread.ActiveSheet.PrintInfo.BestFitCols = chkBestCol.Checked;
fpSpread.ActiveSheet.PrintInfo.ShowPrintDialog = true;
fpSpread.Sheets[0].PrintInfo.Orientation = FarPoint.Win.Spread.PrintOrientation.Auto;
fpSpread.ActiveSheet.PrintInfo.Preview = true;
fpSpread.ActiveSheet.PrintInfo.UseSmartPrint = true;
fpSpread.PrintSheet(0);
As you can see, the Print Preview window does not appear maximized and precisely that is the client’s requirement: that by default it appears maximized.
Is there any property of PrintInfo to accomplish this?
Thanks.
Posted 6 February 2019, 7:07 am EST
Hello,
You can customize the print preview dialog to display it in maximized form if you set up another form with a PrintPreviewControl on it you can do the same.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim pi As New FarPoint.Win.Spread.PrintInfo
pi.Preview = True
pi.Orientation = FarPoint.Win.Spread.PrintOrientation.Auto
pi.UseSmartPrint = True
pi.ShowPrintDialog = True
pi.ShowColumnHeader = FarPoint.Win.Spread.PrintHeader.Show
pi.ShowRowHeaders = FarPoint.Win.Spread.PrintHeader.Show
pi.ShowGrid = True
pi.ShowBorder = True
pi.ShowShadows = True
pi.ShowColor = True
pi.UseMax = True
pi.BestFitCols = True
FpSpread1.ActiveSheet.PrintInfo = pi
FpSpread1.PrintSheet(0)
End Sub
Private Sub FpSpread1_PrintPreviewShowing(sender As Object, e As FarPoint.Win.Spread.PrintPreviewShowingEventArgs) Handles FpSpread1.PrintPreviewShowing
e.Cancel = True
Dim f As New Form2
f.WindowState = FormWindowState.Maximized
f.PrintPreviewControl1.Document = e.PreviewDialog.Document
f.ShowDialog()
End Sub
Please have a look at attached sample for the same.
Hope it helps.
Thanks,
Reeva
CustomPrintPreviewDialog-SpreadWin.zip