PrintBarManager.Initialize(PrintControl) Method

Performs basic initialization of the created PrintBarManager object and associates it with the specified PrintControl.

Namespace: DevExpress.XtraPrinting.Preview

Assembly: DevExpress.XtraPrinting.v20.1.dll

Declaration

public void Initialize(
    PrintControl printControl
)
Public Sub Initialize(
    printControl As PrintControl
)

Parameters

Name Type Description
printControl PrintControl

A PrintControl object, displaying a document in Print Preview.

Remarks

After creating a PrintBarManager instance, you need to provide it with all necessary UI elements (such as toolbar buttons, menu items and status bar panels) and assign a PrintControl to its PrintBarManager.PrintControl property.

Call the Initialize method to initialize the PrintBarManager and become able to use its bar items for performing various actions over a document displayed by PrintControl.

NOTE

Calling the Initialize method removes any elements contained in the BarManager.Items collection and populates the PrintBarManager with default elements from scratch.

Examples

This example illustrates how to create PrintControl and PrintBarManager objects at runtime, and link them together.

After creating a PrintBarManager instance, provide all necessary UI elements to it by calling its PrintBarManager.Initialize method and assign a PrintControl to its PrintBarManager.PrintControl property.

using DevExpress.XtraPrinting.Control;
using DevExpress.XtraPrinting.Preview;
// ...

// Create a PrintControl instance and add it to the current form.
PrintControl printControl = new PrintControl();
this.Controls.Add(printControl);

// Create a PrintBarManager object.
PrintBarManager barManager = new PrintBarManager();

// Set the PrintControl to be its parent form.
barManager.Form = printControl;

// Create all bar and menu items for a bar manager and
// assign it to the specified PrintControl object.
barManager.Initialize(printControl);
See Also