I have a FlowLayoutPanel
that I add 50 UserControl
to dynamically. The panel is positioned vertically and each user control has some labels that are read-only.
I use this.KeyPreview = true;
in the form so I can use the event handler Form1_KeyUp
to catch keyUp
event.
In this event handler, I catch the navigation buttons ↑, ↓, →, ←, PageUp and PageDown.
When I click the navigation button ↑ the previous UserControl
is selected in the panel and when click ↓ the next UserControl
is selected. This works good.
The customer want also to be able to use PageUp and PageDown which I catch in the event handler Form1_KeyUp
as I mentioned before.
I hope that I can find which UserControl
that are visible. Assume UserControl
with index 1,2,3,4 are visible in the panel then I can select user control at index 1 when I use PageUp and user control at index 4 when I click PageDown.
Any help is welcome.