无闪烁开关最顶层的形式 [英] Switching top-most form without flickering

查看:126
本文介绍了无闪烁开关最顶层的形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个放大镜在C#.NET(使用WindowsForm),显示了最上面的点击能够通过形式。这最顶层窗口显示在屏幕的特定部分。

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?

感谢。

推荐答案

使用窗体的Opacity属性。将其设置为99%,在设计师。当您准备好采取截屏,将其设置为0,使拍摄和设置回0.99。

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.

的变化是即时的,无需等待和无闪烁或重新油漆。做的没有的恢复到1.0,即闪烁。

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 :)

这篇关于无闪烁开关最顶层的形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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