Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6823845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:49:54+00:00 2026-05-26T21:49:54+00:00

I have a panel (here called parent), where I draw a calculated picture. Some

  • 0

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).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:49:55+00:00Added an answer on May 26, 2026 at 9:49 pm

    Solution

    Description

    I found now a solution, that reacts sufficiently fast to hoovering areas with the mouse.
    The Main pictures is drawn in a PictureBox instance, in more detail its property Image is assigned.
    The SizeMode property is set to Zoom, that automatically centers and resizes the image with keeping the aspect ratio of the assigned image.
    I use a dynamically created Picturebox instance for each map area (childs), that is invisible, if the mouse does not hoover over it.
    At hoovering over the map area the child shall appear – this is done in the mouse move event of the parent PictureBox,
    where I iterate over the children, detecting whether the mouse position is in the bounds of a child.
    The found child is set visible. Therefore the mouse enters this child control.
    In the leave event of the child control I set it invisible again.
    I experienced losses of mouse leave events for the child controls, if the mouse is moved too fast over all map areas.
    I assume, if the mouse pointer already left the area before it has been set visible, the event is never raised.
    The solution is, that all (other) child controls are set invisible, if in the mouse move event handler of the parent control does find no (a) child control.

    Steps to implement

    What to do, to implement my solution:

    • Use a designed parent PictureBox instance.
      • Assign the (dynamically) drawn picture to the Image property
      • Set SizeMode to Zoom
      • a list of Picturebox instances as form field

    At assignment of a newly calculated image to the parent Picturebox instance:

    • remove all child controls, its event handler, its entry from the list, if they already exist.
    • create dynamically a PictureBox instance for each map area and add it to a list.
      • add it to the parent PictureBox instance as a child control.
      • set its Tag property points to a data object containing the origin map bounds and the object represented by the rectangular map area.
      • set the bounds to the map area scaled and centered according to the bounds of the parent Picturebox instance, that it suits the automatically zoomed image.
      • register a mouse click event
      • register a mouse leave event
      • set background color to e. g. semi transparent green
      • set Visible to false

    In the parent Picturebox instance the mouse over event handler does:

    • finding the child Picturebox instance, where the mouse points at
    • if found it sets the found child visible
    • set all (other) child Picturebox invisible

    In the parent Picturebox instance the resize event handler does:

    • scale/move all the map area Picturebox instances according to the bounds of the parent image and the bounds of the parent Picturebox instance.

    The mouse leave event of each map area Picturebox instance set itself invisible (losses of events previously mentionned).
    The mouse click event of each map area Picturebox instance makes whatever shall be done by clicking the map area.
    Here playing a sine tone of the right chromatic pitch.

    Pictures

    The pictures below show the prototype with the map areas (not yet correctly aligned, some offset):

    The first picture is for illustration of parent picture and all map areas.
    The main picture (scale) and all map areas (dynamically created child Picturebox instances) are drawn in the first picture (by disabling the invisible action for map areas).

    first picture

    The second image is productive, where the mouse hoovers over tone G4.
    In the second image the form has been resized – therefore the parent image is automatically been centered and resized.
    The map areas were simply changed in their Bound property in the resize event handler of the parent PictureBox.
    And the invisible action has been enabled for the map areas.

    second picture

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the scenario: I have a repeater inside an UpdatePanel called updPanel. Inside this
Okay, here a situation: 1) I have a Panel called panel1 that consist one
Hey guys I have a little issue here. I have a panel where I
I have panel that is using group layout to organize some label. I want
I have a panel on an aspx page which contains an UpdatePanel. This panel
I have a Panel and I am adding controls inside this panel. But there
I've got a strange problem here. I have a winforms panel which programatically has
I have this in a class called MessageQueueReceive. public MessageQueueTransaction BlockingReceive(out Message message) {
I feel really dumb for asking this question, but here it goes. I have
i have a text-box within an update panel that is called on a button

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.