Switching top-most form without flickering

假如想象 提交于 2020-01-03 13:03:19

问题


I'm developing a magnifier in C# .NET (using WindowsForm) that shows a top-most click-able through form. This top-most window shows an specific part of the screen.

The problem I'm having is that to take the screenshot I need to Hide() and Show() the form (otherwise I would take a screenshot of the magnifier) and this creates an annoying flickering in which the magnifier disappears and rapidly appears again.

How could I take a screenshot of the Desktop without hiding/showing the form? Is there another approach/workaround?

Thanks.


回答1:


Use the form's Opacity property. Set it to 99% in the designer. When you are ready to take the screen shot, set it to 0, make the shot and set it back to 0.99.

The change is instant, no need to wait and no flicker or repainting. Do not restore it to 1.0, that flickers.

Do beware that you remove the "Hall of Mirrors" effect from the magnifier. Bit of a loss :)



来源:https://stackoverflow.com/questions/17118054/switching-top-most-form-without-flickering

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!