Hi,
I have attached a demo project that simulates Excel like navigation and selection. Other developers may find this useful.
e.g.
-Holding ctrl plus arrow key down skips to the next change from empty to filled cell (or vice versa).
-Shift Ctrl plus arrow key selects all cells between active and the next change from empty to filled cell (or vice versa).
The behaviour is slightly different to Excel in that it skips to both cells on either side of the empty/filled cell interfaces. But the result is the same in that it makes it much quicker to navigate around the spreadsheet and select tables of data.
I also attempted to simulate the Excel behaviour that allows multiple entry of the same value into all selected cells.
When entering a value in a cell; rather than simply pressing enter to enter the value, holding the ctrl key down while pressing enter should fill all of the selected cells with the value entered. So selecting range A1:B2 and typing '5' in cell A1 and holding ctrl + [enter] should fill cells A1:B2 with the number '5'.
The code to do this starts on line 110 in SyncExcelLikeNavigation, which attempts to trap the combination of the ctrl key hold and [enter]:
else if (m_grid.CurrentCell.IsEditing && e.Control && !e.Alt && (e.KeyCode == Keys.Enter) && !e.Shift)
However, it seems that the key code does not show enter when the ctrl key is held down. To confirm this, view the output window with the results of the statement on line 79:
Debug.WriteLine(Enum.GetName(typeof(Keys), e.KeyCode));
Is this a defect?
When will it be resolved?
Is there a work around?
Many thanks,
Steve
EnterKeyDemo.zip