Skip to main content
A newer version of this page is available. .

PrintControl.ExecCommand(PrintingSystemCommand, Object[]) Method

Executes the specified command with custom parameters.

Namespace: DevExpress.XtraPrinting.Control

Assembly: DevExpress.XtraPrinting.v18.2.dll

Declaration

public void ExecCommand(
    PrintingSystemCommand command,
    object[] args
)

Parameters

Name Type Description
command PrintingSystemCommand

A PrintingSystemCommand enumeration value, specifying the command to execute.

args Object[]

A collection of Object values, specifying custom parameters to pass to the executed command.

Remarks

Important

This method takes effect only in Windows Forms applications.

Use this method to perform various actions in Print Preview and maintain the visibility of corresponding UI elements. The PrintingSystemCommand enumeration lists all available actions.

Consider the following before calling this method:

Example

This example illustrates how to execute commands corresponding to various end-user actions in Print Preview by using the PrintControl.ExecCommand method of the DocumentViewer control.

Some of these commands are called without any parameters, while others require calling an overloaded version of the PrintControl.ExecCommand method accepting custom parameter values.

using DevExpress.XtraPrinting;
// ...

// Zoom a document to fit the entire page into Print Preview dimensions.
documentViewer1.ExecCommand(PrintingSystemCommand.ViewWholePage);

// Invoke the Hand tool.
documentViewer1.ExecCommand(PrintingSystemCommand.HandTool, new object[] {true}); 

// Hide the Hand tool.
documentViewer1.ExecCommand(PrintingSystemCommand.HandTool, new object[] {false});

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ExecCommand(PrintingSystemCommand, Object[]) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also