Reports for WinForms | ComponentOne
In This Topic
    Disabling the Context Menu
    In This Topic
    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:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Me.C1PrintPreviewControl1.PreviewPane.ContextMenuStrip = Nothing
    

    To write code in C#

    C#
    Copy Code
    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.