Flicker in with Layered Windows

R

rory.groves

I am displaying a semi-transparent dialog window (Opacity=50%) over
another window. Whenever the background window is Invalidated, it
causes a flicker in the foreground layered window.

For example, an animated gif will cause this flicker in any region of
the layered window that is over the animation.

Is there any solution to this?

(fyi, double-buffered doesn't do anything. Setting Opacity=100%
resolves this but then i lose the semi-transparency)
 
R

rory.groves

I am using custom double-buffering through offscreen contexts. This
flicker only occurs when there is a background-control repaint
underneath the layered window while it is semi-transparent.

No one else has experienced this issue?
 
B

Bob Powell [MVP]

LayeredWindow should never flicker because the system does the compositing.
Double buffering is also unecessary for layered windows because they supply
a buffer on which you should draw anyway so adding more buffering layers
just serves to slow things down.

Post some code you may have made an easily spottable mistake.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
R

rory.groves

LayeredWindow should never flicker because the system does the compositing.
Double buffering is also unecessary for layered windows because they supply
a buffer on which you should draw anyway so adding more buffering layers
just serves to slow things down.

Post some code you may have made an easily spottable mistake.

This project reproduces the problem in its entirety. Notice that the
only area of flicker is where the Layered Window is over top the
animated image.

http://www.grovesinternet.com/flickerywindows.zip


Thanks,
Rory
 
B

Bob Powell [MVP]

It doesn't reproduce this problem at-all on my system.

I see an awful flicker when I invalidate the main screen by resizing but the
layered window is as steady as a rock.

I suggest a graphics driver update.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.


LayeredWindow should never flicker because the system does the
compositing.
Double buffering is also unecessary for layered windows because they
supply
a buffer on which you should draw anyway so adding more buffering layers
just serves to slow things down.

Post some code you may have made an easily spottable mistake.

This project reproduces the problem in its entirety. Notice that the
only area of flicker is where the Layered Window is over top the
animated image.

http://www.grovesinternet.com/flickerywindows.zip


Thanks,
Rory
 
R

rory.groves

It doesn't reproduce this problem at-all on my system.

I see an awful flicker when I invalidate the main screen by resizing but the
layered window is as steady as a rock.

I suggest a graphics driver update.

Really?! That would be one option I never considered.

Maybe you can answer this: When I mouse-down on the DialogForm's
caption bar, and for the whole time the mouse is depressed (ie,
dragging the window around), there is no flicker in the region that
overlaps the background animation.

As soon as I release the mouse button, the flickering resumes.


Thanks,
Rory
 
R

rory.groves

It doesn't reproduce this problem at-all on my system.

I see an awful flicker when I invalidate the main screen by resizing but the
layered window is as steady as a rock.

I suggest a graphics driver update.


Really!? I never considered this.

Maybe you can answer this question: When I mouse-down over the Layered
Window's caption bar, to move it, the flickering stops and there is no
flickering for the whole time I am moving the window around.

As soon as I release the mouse button, the flickering resumes (in the
region overlapping the background form's animation).


Thanks,
Rory
 
R

rory.groves

An update on this...

I happened to close my laptop-lid while the application was still
running. When I re-opened the laptop later, the flicker was gone
completely! This is a totally reproduceable thing: run application,
see flicker in layered windows. Close laptop lid, reopen and it goes
away.

So we're almost definitely dealing with a graphics card / driver
issue, yes?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top