tags:

views:

136

answers:

1

greetings. i have an issue with the following code. for some reason whenever it is executed it is consuming around 60% of the CPU. this is strange, and was wondering if you had any comments?

    private void HomeTableLayoutPanel_MouseMove(object sender, MouseEventArgs e)
    {

        PictureBox HomeCurrentPicBox = (PictureBox)(HomeTableLayoutPanel.GetChildAtPoint(e.Location));
        TableLayoutPanelCellPosition HomeCurrentPosition = new TableLayoutPanelCellPosition(-1, -1);

        if (HomeCurrentPicBox != null)
        {
            HomeCurrentPosition = HomeTableLayoutPanel.GetCellPosition(HomeCurrentPicBox);
            gameFormToolTip.SetToolTip(HomeTableLayoutPanel, GameModel.alphaCoords(HomeCurrentPosition.Column) + "," + HomeCurrentPosition.Row.ToString());
        }
    }

thank you for your time.

edit: im told it is sampling too often. in some aspects this is true in my other semi working code. but my question is too lengthy and i cant explain it. :(

+1  A: 

can't you just attach to the mousemove event of the (each?) PictureBox?

Rob Fonseca-Ensor
no i cannot because there are 100 of them. the code will be inefficient.
iEisenhower
i get what you are are saying. point to a single event method for all picturebox members. got it.
iEisenhower