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

  • Home
  • SEARCH
  • 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 107187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:42:52+00:00 2026-05-11T01:42:52+00:00

I am struggling with something that I think should be easily (ish). I have

  • 0

I am struggling with something that I think should be easily (ish). I have a windows form and a flowgridlayout panel at the bottom of the form. Inside this form I dynamically populate it with X number of User Controls. The controls are all the same type.

The goal is when the user hoovers the mouse over the user control it opens another form and positions it where the mouse is. When mouse leaves the form the opened form disappears.

This almost works great. The problem is when the User Control has anything like a label or text box inside it. It is considered to have left the UC so the form disappears.

My thought was then to use the X and Y to tell if it is inside the UC but I can not figure this out.

Can I ask:

1) What is the best approach to this? 2) How can I code it, as the UC’s are dynamic I can not know exactly where they will be.

Thanks

EDIT

I am trying to figure out the mouse pointers but not getting there. The code below is within the UC SmallTagBox_MouseLeave event:

        Point loc = this.Location;         Point p = this.PointToScreen(this.Location);         Point p2 = this.PointToScreen(this.Parent.Location);          Point ms = MousePosition;         Rectangle screenBounds = new Rectangle(this.PointToScreen(this.Location), this.Size);         if (!screenBounds.Contains(ms))         {             thw.Close();             thw = null;         } 
  • loc {X = 275 Y = 3} System.Drawing.Point
  • p {X = 808 Y = 908} System.Drawing.Point
  • p {X = 808 Y = 908} System.Drawing.Point
  • p2 {X = 545 Y = 1542} System.Drawing.Point
  • ms {X = 574 Y = 914} System.Drawing.Point
  • screenBounds {X = 808 Y = 908 Width = 62 Height = 29} System.Drawing.Rectangle

I do not understand how p2 (its parent) can have a greater Y value relative to the screen.

  • 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. 2026-05-11T01:42:53+00:00Added an answer on May 11, 2026 at 1:42 am

    Hooking all the controls MouseEnter and MouseLeave events, then figuring out if it is still inside the form is pretty painful. A simple timer can get the job done too:

      public partial class Form1 : Form {     private Timer mTimer;     public Form1() {       InitializeComponent();       mTimer = new Timer();       mTimer.Interval = 200;       mTimer.Tick += mTimer_Tick;       mTimer.Enabled = true;     }     private void mTimer_Tick(object sender, EventArgs e) {       if (!this.DesktopBounds.Contains(Cursor.Position)) this.Close();     }   } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling with something that should be fairly easy I think. I have a
I'm struggling with something that should be really easy I think. I have a
I'm really struggling with something that should be a simple matter: Showing a user
I'm fairly new to jquery and struggling with something that should be fairly simple.
Using the vote_fu plugin for rails 3, I'm struggling with something (that I think)
I have been struggling with what I think is something simple. I am setting
I'm struggling with something that i think would be simple. I know that i've
I'm struggling with something that I thought is quite simple - to generate documentation
I'm struggling to combine nohup, open_init_pty and sudo in a one-liner. Something like this:
This is a question I have been struggling with for a while. What is

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.