面板清除一切
我想将面板重置为其初始状态。例如,我将图像设置为背景,并在面板的一部分上绘制图形。我必须清除一切。如何?
I would like to reset a panel to its initial state. For example, I set an image as background, and I draw graphics on a part of the panel. I have to clear everything. How?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您必须先清除面板:
然后调用初始表单:
You have to clear the panel first:
Then call the initial form:
使用以下代码从面板中删除所有图形
如果您需要将某些内容添加到面板的初始状态,那么在调用 invalidate 之后,您必须再次设置这些内容。
如果面板的初始状态需要一些图形或数据,您可以将其放入面板的图形事件中,因此每次调用无效时,您的面板都会获得这些项目的初始状态。
Use the following code to delete all graphics from the panel
If there is something you need to add to panel's initial state then after you call invalidate you again have to set those things.
If the initial state of panels needs some graphics or data you can put that in panel's graphics event, so everytime invalidate is called your panel get the initial state with those items.
使用
panel1.refresh();
命令。它将面板重置为其初始状态。Use the
panel1.refresh();
command. It resets the panel to its initial state.这是唯一对我有用的解决方案:
This was the only solution that worked for me:
这对我有用:
This worked for me: