C#TableLayoutPanel MouseMove太多CPU了

时间:2010-02-26 14:45:12

标签: c# mousemove

问候。我有以下代码的问题。出于某种原因,无论何时执行它都会消耗大约60%的CPU。这很奇怪,想知道你有没有评论?

    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());
        }
    }
谢谢你的时间。

编辑:我告诉它经常采样。在某些方面,这在我的其他半工作代码中也是如此。但我的问题太冗长了,我无法解释。 :(

1 个答案:

答案 0 :(得分:1)

你不能只附加到(每个?)PictureBox的mousemove事件吗?