GDI +和桌面交互 [英] GDI+ and desktop interaction

查看:37
本文介绍了GDI +和桌面交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不是一个真正的编码问题,更多的是我试图理解为什么会发生以下情况。虽然有人可以提供一个非常棒的解决方案。



我用Winforms和GDI +编写了一个屏幕保护程序,它将形状绘制到手动控制的缓冲区然后渲染完成图像到表格。一切都按预期工作。 (东西在屏幕上飞来飞去)



作为一个经过深思熟虑的我决定添加一个移动的间谍洞,它使用表格透明度键切入到我的表格下面的桌面。



这也可以正常工作,但会给动画带来波动性。使用秒表功能进行一些测试后:它不会降低系统上的过载。我的间谍洞需要大约5000个刻度来渲染。我也尝试了各种合成和平滑选项,效果很小或没有效果。



屏幕保护程序以大约30fps的速度运行,并根据系统性能自行调整以保持这一点。 br />


我猜这个问题是由于桌面被独立于我的表单重新绘制并导致暂停而造成的?或者还有其他原因吗?



我的尝试:



包含在问题描述中。

This isn't really a coding question, more me trying to understand why the below is happening. Though if someone can provide a solution that would be fantastic.

I've written a screensaver using Winforms and GDI+ that draws shapes to a manually controlled buffer then renders the finished image to the form. Everything works as intended. (stuff flies around the screen)

As an after-thought I decided to add a moving "spy-hole" that uses the forms transparency key to cut through to the desktop below my form.

This also works fine but introduces "choppyness" to the animation. After doing some tests with the Stopwatch function: Its not down to excessive load placed on the on the system. My "spy-hole" takes around 5000 ticks to render. I have also tried various compositing and smoothing options to little or no effect.

The screen saver runs at around 30fps and adjusts itself based on system performance to maintain this.

I'm guessing that the issue is caused by the desktop being repainted independently of my form and causing pauses while it does so? Or could there be another reason?

What I have tried:

Included in the problem description.

推荐答案

不要在表格上打洞,而是拍摄桌面的屏幕截图,然后将其用作您绘制的第一张图片在您的表单上,然后在其上绘制您的其他图形。根本不需要透明度。
Instead of making a hole through the form, take a screen shot of the Desktop and then use that as the first image you paint on your form, then paint your other graphics on top of it. No transparency needed at all.


这篇关于GDI +和桌面交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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