How to avoid menu on RMouse button
-
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
-
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
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 theDataGrid.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 fromDataGrid.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-----
-
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 theDataGrid.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 fromDataGrid.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-----
It's right. But I thought, that someone could solve this problem in simpler way. Thx. Hi, AW
-
It's right. But I thought, that someone could solve this problem in simpler way. Thx. Hi, AW
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-----