ComponentOne Preview Classic for WinForms: Preview Classic for WinForms Task-Based Help > Displaying Multiple Documents in C1PrintPreview

Displaying Multiple Documents in C1PrintPreview

To display multiple documents in C1PrintPreview, use the Add method. Add the following code to the Form_Load event:

      Visual Basic

' Create Document1.

Dim Document1 As New C1.C1PrintDocument.C1PrintDocument

Document1.StartDoc()

Document1.RenderInlineText("This is Document1.", New Font("Arial", 48, FontStyle.Bold), Color.DarkViolet)

Document1.EndDoc()

 

' Create Document2.

Dim Document2 As New C1.C1PrintDocument.C1PrintDocument

Document2.StartDoc()

Document2.RenderInlineText("This is Document2.", New Font("Tahoma", 48, FontStyle.Bold), Color.Tomato)

Document2.EndDoc()

 

' Display the documents in C1PrintPreview.

Me.C1PrintPreview1.Pages.Add(Document1.PageAsMetafile(1, True))

Me.C1PrintPreview1.Pages.Add(Document2.PageAsMetafile(1, True))

      C#

// Create Document1.

C1.C1PrintDocument.C1PrintDocument document1 = new C1.C1PrintDocument.C1PrintDocument();

document1.StartDoc();

document1.RenderInlineText("This is Document1.", new Font("Arial", 48, FontStyle.Bold), Color.DarkViolet);

document1.EndDoc();

 

// Create Document2.

C1.C1PrintDocument.C1PrintDocument document2 = new C1.C1PrintDocument.C1PrintDocument();

document2.StartDoc();

document2.RenderInlineText("This is Document2.", new Font("Tahoma", 48, FontStyle.Bold),Color.Tomato);

document2.EndDoc();

 

// Display the pages in C1PrintPreview.

this.c1PrintPreview1.Pages.Add(document1.PageAsMetafile(1, true));

this.c1PrintPreview1.Pages.Add(document2.PageAsMetafile(1, true));

This topic illustrates the following:

C1PrintPreview displays both documents.

 


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.