[]
        
(Showing Draft Content)

GrapeCity.ActiveReports.Viewer.Win.Viewer.SetShortcutCommandState

SetShortcutCommandState Method

SetShortcutCommandState(ViewerCommand, bool)

Sets the enabled or disabled state of a specified viewer command.

Declaration
public void SetShortcutCommandState(ViewerCommand viewerCommand, bool state)
Parameters
Type Name Description
ViewerCommand viewerCommand

The ViewerCommand for which to set the enabled state.

bool state

If true, the command is enabled; otherwise, it is disabled.

Remarks

This method allows for the dynamic enabling or disabling of commands within the viewer, which can be useful for adjusting the available actions based on the current state or selection within the viewer. For example, disabling a 'Print' command when no document is loaded.

Examples
// Assuming 'viewer' is an instance of Viewer.
// Enabling the Print command.
viewer.SetShortcutCommandState(ViewerCommand.Print, true);
// Disabling the ZoomIn command.
viewer.SetShortcutCommandState(ViewerCommand.ZoomIn, false);
Exceptions
Type Condition
ArgumentNullException

Thrown if the toolbar shortcut storage has not been initialized.