I am making a small application that shows visually a mapping of equal sized rectangular chips on a wafer. I am doing this by drawing rectangles directly on an area of my main form. I now need to allow a user to give an apparent focus to a chip on this mapping, either with by clicking on it with the mouse or by navigating around the mapping with the arrow keys.
I have solved the mouse click focus, where I examine the x and y coordinates of the left mouse click event, decide if these coordinates coincide with the location of a chip, and then paint the selected chip with a different color and store the coordinates as the currently selected coordinates.
The problem I have now is navigating around the mapping with the arrow keys, where for example clicking on the "down arrow" will move the selected chip to the one below (if it exists). I can capture the KeyDown event and recognize whether the key pressed is an arrow key. The problem, however, is that the main form which I am drawing on, does not accept focus. I would like to use the arrow keys to navigate around the mapping IF the mapping image has the current focus and not any of the input field controls on the form. For example, the user should be able to click on the mapping, and this would remove the focus from all other controls on the form. but since the main form itself does not accept focus, I cannot do this.
How can I do this? I am relatively new to Visual C#.
Do I have to put some kind of focus-accepting control on my form, and draw my mapping on that instead of the main form? If so, what control would that be?
Thanks for any help!