Articles in this section
Category / Section

How to disable context menu for vertical scrollbar in WinForms GridControl?

3 mins read

WinForms Grid Control, you can disable the context menu for scroll bar by cancelling the showContextMenu Here, context menu is handled by comparing the width of the ClientRectangle and the width of the mouse pointer for vertical scroll bar.


this.gridControl1.ShowContextMenu += gridControl1_ShowContextMenu;
void gridControl1_ShowContextMenu(object sender, Syncfusion.Windows.Forms.ShowContextMenuEventArgs e)
    Point c = this.gridControl1.GridPointToClient(e.Point);
   //Comparing the point for vertical scroll bar
    if (this.gridControl1.ClientRectangle.Width < c.X)
        //context menu has been handled
        e.Cancel = true;


AddHandler Me.gridControl1.ShowContextMenu, AddressOf gridControl1_ShowContextMenu
Private Sub gridControl1_ShowContextMenu(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.ShowContextMenuEventArgs)
    Dim c As Point = Me.gridControl1.GridPointToClient(e.Point)
    ‘Comparing the point for vertical scroll bar
    If Me.gridControl1.ClientRectangle.Width < c.X Then
        'context menu has been handled
        e.Cancel = True
    End If
End Sub



I hope you enjoyed learning about how to disable context menu in WinForms GridControl.

You can refer to our WinForms GridControl feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment