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.

shift-space select row

Thread ID:





17332 Aug 5,2004 04:44 PM Aug 5,2004 06:17 PM Windows Forms 1
Tags: GridControl
Daniel Chait
Asked On August 5, 2004 04:44 PM

Again trying to make the grid act like excel, i put the following code in grid_KeyDown: if ( e.KeyCode == Keys.Space && e.Modifiers == Keys.Shift ) { grid.EndEdit(); GridRangeInfoList rowSelections = new GridRangeInfoList(); foreach ( GridRangeInfo range in grid.Selections.Ranges ) { GridRangeInfo rows = GridRangeInfo.Cells(range.Top, 1, range.Bottom, grid.ColCount); rowSelections.Add(rows); } grid.Selections.Clear(); foreach ( GridRangeInfo range in rowSelections ) { grid.Selections.SelectRange(range, true); } e.Handled = true; } which kind of does what I want, but ends up typing a Space key anyway. Suggestions?

Administrator [Syncfusion]
Replied On August 5, 2004 06:17 PM

I think you will have to derive the grid and override virtual methods to avoid processing the space. Here is a first try at this.
public class MyGridControl : GridControl
	protected override bool ProcessDialogKey(Keys key)
		if ( (key & Keys.KeyCode) == Keys.Space && Control.ModifierKeys == Keys.Shift )
			Selections.SelectRange(GridRangeInfo.Row(this.CurrentCell.RowIndex), true);
			return true;
			return base.ProcessDialogKey (key);
	protected override void OnCurrentCellMoved(GridCurrentCellMovedEventArgs e)
		if(this.CurrentCell.MoveFromRowIndex != this.CurrentCell.MoveToRowIndex)
			GridRangeInfo oldRange = GridRangeInfo.Row(this.CurrentCell.MoveFromRowIndex);
				Selections.SelectRange(GridRangeInfo.Row(this.CurrentCell.MoveToRowIndex), true);
		base.OnCurrentCellMoved (e);


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.