windows窗体中的绘画问题 [英] Painting problem in windows form

查看:24
本文介绍了windows窗体中的绘画问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小的应用程序窗口,单击托盘图标时会弹出.在我提供的上下文菜单(windows 窗体上下文菜单)中,问题是,每当我右键单击窗体时,上下文菜单都会出现,但是在上下文菜单消失时,上下文菜单的边框仍然存在.当我最小化/关闭并重新打开时,一切正常.

I have an small appliction window , pops up when a tray icon clicks. Inside that i have provided context menu (windows form context menu), the problem is, whenever i rightclicks on form, the context menu is appearing but on disappearing of context menu, border of context menu still exists. As i minimises/closes and reopen every thing works fine again.

有人知道它为什么会这样吗?

Any one has any idea why it is behaving like so?

拉维奈克.

推荐答案

在表单上将 DoubleBuffering 设置为 true.这应该可以解决问题.

Set DoubleBuffering to true on the form. This should sort the problem out.

除非您自己使用 Graphics 对象绘制内容?你是吗?

Unless you are drawing the stuff yourself using a Graphics object? Are you?

如果您然后查找 Double缓冲,你可以在几个地方找到这个,比如 鲍勃·鲍威尔代码项目.

If you are then look up Double Buffering, you can find out about this at a few places, such as Bob Powell and Code Project.

如果它没有,并且您想快速解决它,在上下文菜单折叠事件中,您可以调用 form.Refresh() 但要避免这种情况所有成本.

If it doesn't and you want a quick hack to get around it, on the context menu collapse event you could call form.Refresh() but avoid this at all costs.

这篇关于windows窗体中的绘画问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆