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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom Accelrator

Thread ID:

Created:

Updated:

Platform:

Replies:

27362 Apr 11,2005 04:41 PM UTC Apr 11,2005 07:00 PM UTC WinForms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On April 11, 2005 04:41 PM UTC

Hello I would like to provide the user with custom Accelerators on the grid like CTRL+1 will Hide/show the first column I don''t know how...

Administrator [Syncfusion]
Replied On April 11, 2005 07:00 PM UTC

There are 2 possible situations you may have to handle. One is when you want to catch ctl+1 when there is no actively editing cell in the grid. In this case, you can try handling the grid.KeyDown event. The second case is when you want to catch ctl+1 where there is an actively editing cell in teh grid. In this case, you can try handling the grid.CurrentCellControlKeyMessage event. Here are a couple of sample handlers.
private void gridControl1_CurrentCellControlKeyMessage(object sender, GridCurrentCellControlKeyMessageEventArgs e)
{
	Keys keyCode = (Keys) ((int)e.Msg.WParam) & Keys.KeyCode;
	if(e.Msg.Msg == 256) // WM_KEYDOWN
	{
		if(keyCode == Keys.D1 && (Control.ModifierKeys & Keys.Control)!= 0)
		{
			MessageBox.Show("ctl+1");
			e.Handled = true;
			e.Result = false;
		}
	}
}
private void gridControl1_KeyDown(object sender, KeyEventArgs e)
{
	if(e.KeyCode == Keys.D1 && (Control.ModifierKeys & Keys.Control)!= 0)
	{
		MessageBox.Show("ctl+1");
		e.Handled = true;
	}
}

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

;