Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个小应用程序,用于根据用户单击的位置绘制多边形。PictureBox我为此目的构建了一个并实现了它的Paint事件,但是现在当我显示任何MessageBoxes 时,它们似乎呈现在我的主窗口后面。
PictureBox
Paint
MessageBox
我犯了一个很大的错误。当我实现PictureBox'Paint事件时,我调用了Refresh(). Refresh()使主窗口的状态无效,然后导致Refresh()再次调用并再次使窗口无效,依此类推。由于这个事件循环,我MessageBox被隐藏了。
Refresh()
当我Refresh()从事件中删除呼叫时Paint,一切都恢复了!