Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to avoid menu on RMouse button

How to avoid menu on RMouse button

Scheduled Pinned Locked Moved C#
tutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    A Wegierski
    wrote on last edited by
    #1

    I use right mouse button to open next form in overridden OnMouseDown() method in overridden DataGrid (standard DataGrid works ok). Before this, automatic menu (copy, paste etc.) is opened - while creating new form. How to avoid it? Only OnKey...() has Handled property - but OnKey isn't fired. -or- How to add my item to automatic menu (copy, paste etc.)? Thx in advance. Hi, AW

    H 1 Reply Last reply
    0
    • A A Wegierski

      I use right mouse button to open next form in overridden OnMouseDown() method in overridden DataGrid (standard DataGrid works ok). Before this, automatic menu (copy, paste etc.) is opened - while creating new form. How to avoid it? Only OnKey...() has Handled property - but OnKey isn't fired. -or- How to add my item to automatic menu (copy, paste etc.)? Thx in advance. Hi, AW

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      I'm not sure I quite follow, but if you want to change the default context menu, this is a bit tricky and not always possible. Instead, you could create your own ContextMenu (drag one from the Toolbox and design it like any other menu) and assign that to the DataGrid.ContextMenu property. That will completely replace the default context menu, but for things like Cut, Copy, and Paste, it's not hard to reproduce that functionality. You can get the current cell from DataGrid.CurrentCell then cut or copy that text, or replace or append the text with your own paste handler.

      -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

      A 1 Reply Last reply
      0
      • H Heath Stewart

        I'm not sure I quite follow, but if you want to change the default context menu, this is a bit tricky and not always possible. Instead, you could create your own ContextMenu (drag one from the Toolbox and design it like any other menu) and assign that to the DataGrid.ContextMenu property. That will completely replace the default context menu, but for things like Cut, Copy, and Paste, it's not hard to reproduce that functionality. You can get the current cell from DataGrid.CurrentCell then cut or copy that text, or replace or append the text with your own paste handler.

        -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

        A Offline
        A Offline
        A Wegierski
        wrote on last edited by
        #3

        It's right. But I thought, that someone could solve this problem in simpler way. Thx. Hi, AW

        H 1 Reply Last reply
        0
        • A A Wegierski

          It's right. But I thought, that someone could solve this problem in simpler way. Thx. Hi, AW

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          Not everything you need is exposed in .NET because the framework would be huge! This isn't a hard solution, either.

          -----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups