I have a panel (here called parent), where I draw a calculated picture. Some rectangular areas of this picture shall higlight by hoovering over. It is the same behaviour like on a web page using , and , e. g. the german map on the right upper side.
At hoovering the according rectangle shall be covered by a half transparent blue . (And depending on keys like Alt, Ctrl and/or Shift in other colors, and clickable).
The first solution was a single instance of a transparent Panel - inherited from the Panel class. In the hoovering event of the parent I moved and resized the single instance to the right place, changing the color. This had some problems: * moving and resizing (SetBounds()) fired MouseLeave event of the parent and a MouseEnter event of the single panel. The events had to be adapted accordingly to get it working correctly, I did it, but it is was very slow, due to finding the right map area from the list.
The second solution was to generate dynamically an instance of a transparent panel for each map area. Each transparent panel had to set the e. g. Color.FromArgb(50, Color.Blue) at entering, and remove it at leaving the panel. But it seems to be even slower than before. If the mouse hurries over several maps, they are all drawn like hoovered, and slowly get transparent again.
Does anybody know a good solution for this requirements:
- at picture resize in parent panel, map etc. has to be changed as well
- partly transparent highlight hoovered rectangle area.
- detection of Ctrl/Shift/Alt as events for an area and change of the color.
- detect click events there
Are there other controls I better use for this purpose?
Thanks for on practice based ideas.
PS: The world map with satellite pictures shows better what I want to do: At hoovering the background is still visible more or less. But in my case the parent image, its size and the maps are calculated at runtime (after settings are completed by the user).