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.
Unfortunately, activation email could not send to your email. Please try again.

Key Events

Thread ID:

Created:

Updated:

Platform:

Replies:

69705 Nov 8,2007 12:21 PM Nov 9,2007 03:59 AM Windows Forms 2
loading
Tags: GridControl
dwedewdew
Asked On November 8, 2007 12:21 PM

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.

Administrator [Syncfusion]
Replied On November 8, 2007 12:51 PM

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;
}
}
}


dwedewdew
Replied On November 9, 2007 03:59 AM

Thanks.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;