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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:24:51+00:00 2026-05-13T07:24:51+00:00

happy holidays! i have a tablelayoutpanel (10×10). within each cell i have a picturebox

  • 0

happy holidays!

i have a tablelayoutpanel (10×10). within each cell i have a picturebox which are disabled (enabled = false).

i am trapping mouse move over the table to catch mouse movement. here is the code:

        private void tableLayoutPanelTest_MouseMove(object sender, MouseEventArgs e)
    {

        if (!placeShip)
        {
            c = tableLayoutPanelTest.GetControlFromPosition(homeLastPosition.Column, homeLastPosition.Row);

            if (c.GetType() == typeof(PictureBox))
            {
                PictureBox hover = new PictureBox();
                hover = (PictureBox)(c);
                hover.Image = Properties.Resources.water;
            }

            Point p = tableLayoutPanelTest.PointToClient(Control.MousePosition);
            Control picControl = tableLayoutPanelTest.GetChildAtPoint(p);


            if (picControl != null)
            {
                TableLayoutPanelCellPosition me = tableLayoutPanelTest.GetCellPosition(picControl);

                if (picControl.GetType() == typeof(PictureBox))
                {
                    PictureBox thisLocation = new PictureBox();
                    thisLocation = (PictureBox)(picControl);

                    thisLocation.Image = Properties.Resources.scan;
                    homeLastPosition = me;    
                }
            }
        }

        toolTipApp.SetToolTip(tableLayoutPanelTest, tableLayoutPanelTest.GetCellPosition(c).ToString());
    }

when i run this the tooTipApp starts consuming upto 56% of the CPU. so there is something wrong.

also the picturebox image changing code stops working for some reason.

any help is very welcome!

thank you.

  • 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-13T07:24:51+00:00Added an answer on May 13, 2026 at 7:24 am

    A few thoughts:

    • You’re creating another PictureBox called hover – why? This code doesn’t seem to do anything and it’s almost certainly going to slow the loop down. I think you meant to just declare hover and cast it from c, but you’re actually creating a new PictureBox instance and just throwing it away.
    • You’re also never disposing of hover, as far as I can tell – so you end up allocating tons of memory and window handles. In general you should avoid creating new objects at all inside a MouseMove handler (small ones like hit tests are sometimes OK). As with the previous point – you probably didn’t mean to write the new PictureBox().
    • You use PointToClient(Control.MousePosition) when the MouseMove event already gives you the control-specific mouse position (e.X and e.Y). This is costing you more time than it should.
    • Probably the most important, you’re invoking SetToolTip on every MouseMove. You should only be invoking this when the tooltip has actually changed. You need to set a flag on which cell or control the tooltip was last displayed for, check for changes, then call SetToolTip.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

happy holidays! so, Im grappling with coredata!, now I have info showing in a
Happy new year :) I have a Chrome extension which is a popup that
Happy New Year SO users! I have an issue that I hope someone can
I was quite happy with my JSF app which read the contents of MQ
I am using Happy to generate a parser. I have found that when I
Happy Monday o/ I'm looking to do the following within a stored proc select
Happy Friday All, I have an ASP.net 2.0 website that I'm updating to .Net
I am happy with the operator =, which is synthesized by the compiler automatically.
Happy holidays, all. I'll probably feel very silly when I get the answer to
For the last couple of days of my X-mas holidays, I have been struggling

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.