Articles in this section
Category / Section

How to display the Editcontrol content in MS Print Preview control?

1 min read

In EditControl, the PrintDocument property is used to display the contents of EditControl and it can be assigned to MS PrintPreviewControl by using its property named “Document”. And this Document can be displayed by using the function named ShowDialog. The following code example is to demonstrate the same.

C#

//Object creation.
Form PrintForm = new Form();
//Add print preview controls to Form.
PrintForm.Controls.Add(this.printPreviewControl1);
//Assign EditControl print document to PrintPreview control.
this.printPreviewControl1.Document = this.Editcontrol.PrintDocument;
//To show print dialog.
PrintForm.ShowDialog();
//To show the Edit control print preview dialog.
this.Editcontrol.PrintPreview();

VB

'Object creation.
Private PrintForm As New Form()
'Add print preview controls to Form.
PrintForm.Controls.Add(Me.printPreviewControl1)
'Assign EditControl print document to PrintPreview control.
Me.printPreviewControl1.Document = Me.Editcontrol.PrintDocument
'To show print dialog.
PrintForm.ShowDialog()
'To show the Edit control print preview dialog.
Me.Editcontrol.PrintPreview()

Screenshot:

Showing print preview of editor control content

Sample:  https://www.syncfusion.com/downloads/support/directtrac/general/EditControl_PrintPreview-240270914.zip

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied