Intercepting Ctrl+C in a datagrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to intercept Ctrl+C in a datagrid to prevent it performing its default
processing. I have a click selecting the entire row (its uneditable), but
only want to copy the 2nd column's value in my 2 column grid as opposed to
the entire row.

Currently with a boolean and text column I will get back
True This is the text in my column

How can I intercept Ctrl+C to stop this?
I've tried overriding a few of the keypress events but cant find the exact
right one
 
Howabout to override WndProc() of datagrid? (I've never tried this out
before, but it works in TextBox control)

protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case 0x0301: // WM_COPY
// Do whatever you like
break;

default:
base.WndProc (ref m);
break;
}
}
 
Back
Top