Question

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. :(

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top