开发者

How to program an animated background application in C#

开发者 https://www.devze.com 2023-03-04 12:23 出处:网络
I would like to start a Summer Project just for the sake of improving my programming skills. For this I thought it would be nice if I can program an application that will run an animated image or some

I would like to start a Summer Project just for the sake of improving my programming skills. For this I thought it would be nice if I can program an application that will run an animated image or something similar on a windows machine as wallpaper.

For instance I would like to replace the entire screen resolution with some random colored squares that will individually change color at specific intervals. However I just realized that I have no clue on how or were to start from and all the programming I have done in my first two years of study are useless for this particular task.

Could someone put me on the right direction on how to go about. I would like to do some reading but I have now clue what would help me achieve this.

To keep it clearer WHAT DO I NEED TO KNOW before I embark on this开发者_JAVA百科 this project?

Regards.


You want to create an image and save it as some sort of image file. Then use SystemParametersInfo() to set the background passing in SPI_SETDESKWALLPAPER as a flag and also as one of the other parameters your saved file.

Some example code is here: http://social.msdn.microsoft.com/Forums/en-US/windowssdk/thread/8a07f1f9-30ba-40ea-9eef-5f405d666849/

To change it at intervals, you can set a timer which forces regeneration of a new image at set delays, then again call the SystemParametersInfo() as earlier.

Note that your saved image must be .bmp format.


Wouldn't this be simpler as a screen saver? If you're interested, you can read up on how to develop a screensaver at http://www.codeproject.com/KB/cs/scrframework.aspx (albeit an old article)


The full screen bit isn't that tricky - just start a Windows Forms or WPF project and edit the window, make it maximised, always-on-top, no borders, no title bar. Things get more tricky from there however and you'll have to read up on drawing and graphics using either Forms or WPF.

0

精彩评论

暂无评论...
验证码 换一张
取 消