C# TableLayoutPanel MouseMove 太多 CPU
问候。我对以下代码有疑问。由于某种原因,每当它执行时,它都会消耗大约 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());
}
}
谢谢您的宝贵时间。
编辑:我告诉它采样太频繁了。在某些方面,我的其他半工作代码也是如此。但我的问题太长了,我无法解释。 :(
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. :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能只附加到(每个?)
PictureBox
的 mousemove 事件吗?can't you just attach to the mousemove event of the (each?)
PictureBox
?