ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Printing and Previewing Task-Based Help > Formatting Tables > Disabling the Context Menu

Disabling the Context Menu

A context menu appears by default when the C1PreviewPane is right-clicked at run time. This ContextMenuStrip includes settings for manipulating the preview. You can disable this context menu in code by setting the ContextMenuStrip property of the C1PreviewPane to null. Note that this cannot be done in the designer – only in code – but, you can override the default context menu strip with your own in the designer (by dropping a ContextMenuStrip component on the form, and setting the C1PreviewPane's ContextMenuStrip property to that component). When using the C1PrintPreviewControl control, the preview pane can be accessed via the PreviewPane property on the control.

Add the following code to the Form_Load event to disable this context menu in a C1PrintPreviewControl control:

      Visual Basic

Me.C1PrintPreviewControl1.PreviewPane.ContextMenuStrip = Nothing

      C#

this.c1PrintPreviewControl1.PreviewPane.ContextMenuStrip = null;

 What You've Accomplished

The default context menu does not appear when you right-click the preview pane in the C1PrintPreviewControl control.


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