We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Key Events

Hi,

I'm using Syncfusion 4.3.0.30 windows.forms Grid Control in virtual mode.

I want to suppress certain key events triggered by the user (e.g. CTRL + X, CTRL + V, CTRL + Z, DELETE, etc.) if the grid isn't in editing state or the selected cell is readonly or static. Suggestions?

Thanks

Yours

Tobias B.

2 Replies

AD Administrator Syncfusion Team November 8, 2007 05:51 PM UTC

I think you can use grid.CurrentCellKeyDown to get this behavior. Here is the idea.

//subcribe to the event
this.gridControl1.CurrentCellKeyDown += new KeyEventHandler(gridControl1_CurrentCellKeyDown);


//the handler code
void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
GridControl grid = sender as GridControl;
if (grid != null && !grid.CurrentCell.IsEditing)
{
if (e.Control)
{
switch (e.KeyCode)
{
case Keys.V:
case Keys.C:
case Keys.X:
e.Handled = true;
break;
default:
break;
}
}
else if (e.KeyCode == Keys.Delete)
{
e.Handled = true;
}
}
}



DW dwedewdew November 9, 2007 08:59 AM UTC

Thanks.


Loader.
Live Chat Icon For mobile
Up arrow icon