CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009
    Posts
    15

    Question tooltip on disabled control

    happy holidays!

    i have a tablelayoutpanel (10x10). 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.

  2. #2
    Join Date
    Oct 2009
    Posts
    15

    Re: tooltip on disabled control

    this issue is now resolved. it was achived by implementing object state checks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured