I’ve written a custom control in Windows Forms. I dynamically create a vertical scrollbar and capture changes of its value.
Currently, the scrollbar is the only control, which can acquire focus, so my control acts as panel: it transfers focus to the scrollbar. When user uses the scrollbar, all further keyboard events are transfered to it, instead of control itself.
I wish to disable focus for scrollbar completely and implement appropriate behaviors in the control itself (eg. Page up, page down, home, end etc.). I found a property named “CanFocus”, but unfortunatelly it’s read-only.
How can I disable the focusing ability for the scrollbar? I know, that I can implement the Focus event and manually transfer the focus to the control, but maybe there is a ready solution in the WF libraries?
Thanks to Łukasz O. for help.
The solution: