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.
Syncfusion Feedback

Key Events

Thread ID:

Created:

Updated:

Platform:

Replies:

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

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


dwedewdew
Replied On November 9, 2007 08:59 AM UTC

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.

Warning Icon 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.Close Icon

;