Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 11-Nov-16 8:29am

1 solution

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.
 
Share this answer
 
Comments
5everin 11-Nov-16 14:53pm    
Thanks. That would work, I didn't mention that the program can use multiple monitors. Any idea if that would add complications.

(edit) was worried that a screen grab would only pick up the contents of the primary monitor, it doesn't.
Dave Kreskowiak 11-Nov-16 17:15pm    
Nope.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900