Results 1 to 2 of 2

Thread: Right Click popup in DGV

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    402

    Right Click popup in DGV

    I currently have written a routine that produces a popup contex menu when mouseButtons.Right is clicked. This works great unless the actual cell in the DGV is being edited. In which case It produces two popups. The one i created and the following:-Name:  Capture.PNG
Views: 204
Size:  12.4 KB

    How do I disable this popup, (just allowing my defined popup) when the cursor is in the DGV area of the form

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Right Click popup in DGV

    When you edit a cell in a DataGridView, a control is created and embedded in that cell. Most cells are DataGridViewTextBoxCells so the control is usually a TextBox. What you're seeing is the standard context menu for a TextBox and you would suppress it the same way you would for a standard TextBox. One option is to set the ShortcutsEnabled property of the editing control to False, but that would also disable keyboard operations like copy and paste. I think that the other option is to handle the MouseClick event, trap the right mouse button and set e.Handled to True, but I'd have to test that to confirm and I'm not inclined to do that myself.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width