Hi,
If I have a grid that is configured to use Row Selections only and has a horizontal scroll bar is there anyway to get the grid to scroll sideways using the keyboard.
In Excel I can press the Scroll Lock key and it lets me scroll around the grid without changing the active row but it doesn't seem to work in the Win Grid. So is there any magic key combination or setting to get it to scroll horizontally using the keys?
Alternatively, is there any example code knocking about to reproduce the Excel behaviour?
Thanks,
John.
Sticking the following into the KeyDown event seems to do the trick:
If My.Computer.Keyboard.ScrollLock Then Select Case e.KeyCode Case Keys.Up Me.ActiveRowScrollRegion.Scroll(RowScrollAction.LineUp) e.Handled = True Case Keys.Down Me.ActiveRowScrollRegion.Scroll(RowScrollAction.LineDown) e.Handled = True Case Keys.Left Me.ActiveColScrollRegion.Scroll(ColScrollAction.LineLeft) e.Handled = True Case Keys.Right Me.ActiveColScrollRegion.Scroll(ColScrollAction.LineRight) e.Handled = True End Select End If
Select Case e.KeyCode Case Keys.Up Me.ActiveRowScrollRegion.Scroll(RowScrollAction.LineUp) e.Handled = True Case Keys.Down Me.ActiveRowScrollRegion.Scroll(RowScrollAction.LineDown) e.Handled = True Case Keys.Left Me.ActiveColScrollRegion.Scroll(ColScrollAction.LineLeft) e.Handled = True Case Keys.Right Me.ActiveColScrollRegion.Scroll(ColScrollAction.LineRight) e.Handled = True End Select
End If