C#:创建一个图形化的屏幕保护程序 [英] C#: Creating a graphical screensaver

查看:135
本文介绍了C#:创建一个图形化的屏幕保护程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑创建一个屏幕保护程序。我有整个事情,它的图形,并在我的脑海后端样的准备。但我不太知道如何让显卡出代码。

I am thinking about creating a screen saver. I have the whole thing, its graphics and the back-end kind of ready in my head. But I am not quite sure how to get the graphics out in code.

我想是影像的幻灯片带着几分运动(有点像在媒体中心幻灯片),并在上面一些漂浮文字和形状。形状莫名其妙半透明。

What I would like is a slide show of images with a bit of movement (kind of like the slide show in media center) and some floating text and shapes on top. The shapes somehow translucent.

目前,我有一个非常简单的静态的幻灯片中的WinForms的。只是一个简单的应用程序,全屏变,并显示一些图像,假装褪色他们进出的hackish的一种方式。但它不是很好做​​,而且性能也不是很好。例如为了防止滞后,我淡入上的图像的上部的黑色正方形,而不是实际的图像中的衰落。也许很傻,但它种工作:P

I currently have a very simple static slideshow made in WinForms. Just a simple application that goes fullscreen and displays some images and pretends to fade them in and out in a hackish kind of way. But it is not very well made, and the performance is not very good. For example to prevent lag, I fade in a black square on top of the image, instead of fading in the actual image. Silly perhaps, but it kind of worked :p

不管怎样,我想做得更好。但不知道从哪里开始。 WPF是为这个好的解决办法?或者我应该考虑的DirectX或OpenGL?这是一些很可能使用XNA来处理,或者是太游戏spesific?

Anyways, I would like to do a better job. But not sure where to start. Is WPF a good solution for this? Or should I look into DirectX or OpenGL? Is this something that could be handled well with XNA, or is that too game spesific?

推荐答案

WPF是不是一个坏主意。它利用DirectX和硬件加速的动画和特效。

WPF is not a bad idea. It takes advantage of DirectX and hardware acceleration for its animations and effects.

如果你写这种东西本身(对DirectX或OpenGL的),您将获得更好的性能,但写它的成本会高得多。它很可能你不会需要一个边缘反正。

You will get better performance if you write this kind of stuff natively (against directx or opengl), but the cost of writing it will be much higher. It's quite possible you will not need that edge anyway.

看一看Hanselman的婴儿粉碎 (这是一个全屏幕WPF与动画的应用程序),以获得您可以用WPF做什么把握。

Have a look at hanselman's baby smash (which is a full screen wpf app with animations) to get a grasp of what you can do with wpf.

请注意:我没有写一个幻灯片一种在WPF啄的归途,关键要得到这个工作顺利加载了图像在后台线程和< A HREF =http://msdn.microsoft.com/en-us/library/ms750509.aspx相对=nofollow>冻结它。

Note: I did write a slide show kind of thingy in WPF way back, the key to getting this to work smoothly is loading up the images in a background thread and freezing it.

这篇关于C#:创建一个图形化的屏幕保护程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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