How to remove items from Right Click menu

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Viewer for .NET (v3)  /  How to remove items from Right Click menu

DynamicPDF Viewer for .NET (v3) Forum

Hi ,

I am evaluating  DynamicPDF Viewer for .NET, would like to know how to remove items from right click menu.

Posted by a ceTe Software moderator

You can achieve your requirement by suppressing the default contextmenu and setting your own custom context menu.

You can suppress default context menu in ContextMenuShowing event and add a custom one. You will need create a new context menu by adding items to it and set  respective actions in item click event.

Here is a code sample

Code sample to trigger an event.
pdfViewer1.ContextMenuShowing+=new ContextMenuShowingEventHandler(pdfViewer1_ContextMenuShowing);

Event handler code sample to hide default and add new context menu.

void pdfViewer1_ContextMenuShowing(object sender, ContextMenuShowingEventArgs e)
            e.Cancel = true;
            ContextMenuStrip newMenu = new ContextMenuStrip();
            e.AssignedContextMenu = newMenu;

            ToolStripItem item3 = newMenu.Items.Add("Print");
            item3.Click += new EventHandler(item3_Click);

Event handler for item click event.

       void item3_Click(object sender, EventArgs e)

            MessageBox.Show("Add printing action in this event");

ceTe Software Support Team

All times are US Eastern Standard time. The time now is 5:23 PM.