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 3618526
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:45:49+00:00 2026-05-18T22:45:49+00:00

In .NET window forms a form have collection of control and internally all of

  • 0

In .NET window forms a form have collection of control and internally all of them is just wrap around window subsystem provided by Microsoft windows. Somewhat similar to MFC which is a shallow wrapper around window api. The controls in a form/window create a tree structure and events are received by the leaf nodes e.g. MouseMove event will be receive by window/control directly underneath the mouse.

But in presentation framework microsoft provided RoutedEvent which can have one of following strategies

  1. Tunnel The routed event uses a tunneling strategy, where the event instance routes downwards through the tree, from root to source element.
  2. Bubble The routed event uses a bubbling strategy, where the event instance routes upwards through the tree, from event source to root.
  3. Direct The routed event does not route through an element tree.

My guess is that presentation framework create just one main window and does the drawing by itself for child elements to support the event routing strategies

Now can I change this strategy in my normal window form. I want Tunnel or Bubble and currently window system uses Direct. I want it to receive MouseEnter/MouseLeave event even if there are controls on top of it. One way is Global mouse/keyboard hook. But let say i want to avoid that.

  • 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-18T22:45:49+00:00Added an answer on May 18, 2026 at 10:45 pm

    Windows has bubbling but it is purely based on the message. MouseWheel bubbles for example, but neither MouseEnter nor Leave do. Adding bubbling behavior is technically possible but very hard to get right. Every window in the parent/child tree needs to co-operate and bubble to their parent explicitly.

    It doesn’t solve the problem in this specific case anyway. Key issue is that there’s no guarantee that a MouseLeave for a child control will ensure a MouseEnter for the parent. Mouse move messages are not accurate enough, they don’t guarantee that every traversed pixel is reported. When you have a child window close to the edge of its parent, it is quite easy to not get the MouseEnter for the parent when you move the mouse fast enough.

    This is solved with mouse capture, the Control.Capture property. That ensures a mouse move message is generated even when the mouse is no longer inside the window client rectangle. However, that works well when monitoring the mouse for a single window, not for multiple windows. As soon as you click a control, the control itself usually wants to capture the mouse, canceling the one you started. A button does so for example, it wants to see the MouseUp event so it can redraw the button to show the button-up state.

    Tough cookies. The only decent approach I know for this particular problem is to use a Timer. 200 msec is usually good enough, start it when the mouse enters. In the Tick event handler, use Mouse.Position and Control.PointToClient to check if the mouse is still located inside the outer window rectangle.

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

Sidebar

Related Questions

I have a windows forms application in .NET 3.5. There's one form with 20
Im using c# .net windows form application. I have loaded names of all the
Im using c# .net windows form application. i have a SQL database with 5
Im using c# .net windows form application. I have many databases created using sql
JI have written a .NET C# Windows Form app in Visual Studio 2008 that
Im using c# .net windows application form. I have created many databases with many
Windows form application(.Net 3.5) I have a textbox and a button on the form.
In VB.net 3.5 SP1 I have a Windows Form with three DataGridView controls. One
Im using c# .net , windows form application. I have a XML file which
c# .Net 3.5 visual studio 2008, windows xp I have a main form in

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.