Disable context menu PDFViewCtrl Winform

Product:.net

Product Version:11.3

Please give a brief summary of your issue:
(Think of this as an email subject)

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
want to disable the default context menu

Please provide a link to a minimal sample where the issue is reproducible:

1 Like

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.


To disable the default context menu in PDFViewCtrl for a WinForms application, you can handle the MouseDown event and prevent the context menu from appearing based on your specific conditions.

Some things you can try:

  • Attach an event handler to the MouseDown event of the PDFViewCtrl.

  • Within the event handler, check if the right mouse button was clicked.

  • If it was a right-click, suppress the context menu by setting the appropriate flags or returning from the function without invoking the default behavior.



Here are some resources that might help you:


Hopefully, this helps you solve your problem while you wait for a human to get back to you.

1 Like

Hello,

This is discussed in the following forum post: Disable Context Menu in PDFViewWPF

In summary, you can turn off the default context menu by calling ToolManager.SuppressContextMenu = true;
I suggest searching for this relevant code within the PDFViewWPFTools example as this is documented within the tutorial.

1 Like

Is PDFTron’s ToolManager supported in WinForms? I’m having trouble adding it to my application. Can someone provide the DLL needed for integration?

1 Like

You won’t be able to do this as easily with WinForms since it expects a PDFViewWPF view object.

A solution that should work for both WinForms and WPF is overriding the OnMouseUp(MouseEventArgs) event. The PDFViewCtrl exposes the ability to control what happens when a user right clicks which would allow you to disable what is showed to a user:

We have some discussion on this for one of our older community posts:

1 Like