Click here to Skip to main content
15,919,879 members
Home / Discussions / C#
   

C#

 
GeneralRe: Opacity Control Pin
led mike21-Jun-06 9:29
led mike21-Jun-06 9:29 
QuestionRe: Opacity Control Pin
Dustin Metzgar21-Jun-06 8:33
Dustin Metzgar21-Jun-06 8:33 
AnswerRe: Opacity Control Pin
Cubzfan21-Jun-06 9:31
Cubzfan21-Jun-06 9:31 
GeneralRe: Opacity Control Pin
Dustin Metzgar21-Jun-06 10:04
Dustin Metzgar21-Jun-06 10:04 
GeneralRe: Opacity Control Pin
Cubzfan21-Jun-06 10:10
Cubzfan21-Jun-06 10:10 
GeneralRe: Opacity Control Pin
Alexander Wiseman21-Jun-06 11:59
Alexander Wiseman21-Jun-06 11:59 
GeneralRe: Opacity Control Pin
Cubzfan21-Jun-06 12:17
Cubzfan21-Jun-06 12:17 
GeneralRe: Opacity Control Pin
Alexander Wiseman21-Jun-06 13:11
Alexander Wiseman21-Jun-06 13:11 
Tom,

I tried a few more things, and did a few more Google searches, and here is what I came across (which, I may add, makes much more sense than the double-buffer issue that I related in my previous post). This is on a CP article message board (you can see the article here[^]):

The question

"I like this control alot but when I close my form, all controls on it flicker for a blink of an eye to black and then the fade begins. any suggestions to fix it?"

That looks like your problem exactly. Here is the response:

The response (from the article author)

"Short version:

Check if you are using a transparency key. If not, try and set one. Pick a color that won’t affect your program such as lime green, or some other ugly color that is not used by anything on your form.

Long version:

If it’s the same flicker as one I have seen before, than it has to do with a bug in WinForms and how it deals with transparent windows. WinForms is in fact just a wrapper to the Windows API. When dealing with opacity, WinForms will use a Windows API to convert your form to what is know as a layered window.

“Using a layered window can significantly improve performance and visual effects for a window that has a complex shape, animates its shape, or wishes to use alpha blending effects.” – MSDN

However, WinForms does not make a window a layered window until it feels it is necessary. The flicker you are seeing is WinForms trying to convert a non layered window into a layered one.

The reason why setting a transparency key works is because WinForms will force any window with a transparency key to be of the type layered. Set the transparency key at design time and at runtime the window will always be a layered window. With no need to convert, the flicker goes away.

-Mike."


It seems from his response that the black flicker you see is the changing of the window from a normal window to a layered window. His suggested solution is to set the transparency key (to some color you do not use on the form) which will force the window to be created as a layered window. This should fix the flicker when you first change the opacity.

I gave this a try and it worked well to remove the black flicker on using the sliding control first and on minimize and maximize. However the black background appears when you first load the form, and it looks like a slight flicker to me. This, I think, you probably will not be able to get rid of, it's just that on faster systems you might not see it at all.

FYI, I tried setting double-buffering on with this solution and it didn't seem to make a difference one way or another, so you can probably use it anyway.

Give this a try and let me know the outcome, I'm very interested in this problem!

Sincerely,
Alexander Wiseman
GeneralRe: Opacity Control Pin
Cubzfan21-Jun-06 13:52
Cubzfan21-Jun-06 13:52 
GeneralRe: Opacity Control Pin
Cubzfan22-Jun-06 3:58
Cubzfan22-Jun-06 3:58 
GeneralRe: Opacity Control Pin
Dustin Metzgar22-Jun-06 4:24
Dustin Metzgar22-Jun-06 4:24 
GeneralRe: Opacity Control Pin
Cubzfan22-Jun-06 4:40
Cubzfan22-Jun-06 4:40 
GeneralRe: Opacity Control Pin
Dustin Metzgar22-Jun-06 5:00
Dustin Metzgar22-Jun-06 5:00 
GeneralRe: Opacity Control Pin
Alexander Wiseman22-Jun-06 5:08
Alexander Wiseman22-Jun-06 5:08 
JokeRe: Opacity Control Pin
Dustin Metzgar22-Jun-06 5:14
Dustin Metzgar22-Jun-06 5:14 
GeneralRe: Opacity Control Pin
Alexander Wiseman22-Jun-06 5:24
Alexander Wiseman22-Jun-06 5:24 
GeneralRe: Opacity Control Pin
Cubzfan22-Jun-06 5:11
Cubzfan22-Jun-06 5:11 
GeneralRe: Opacity Control Pin
Dustin Metzgar22-Jun-06 5:35
Dustin Metzgar22-Jun-06 5:35 
GeneralRe: Opacity Control Pin
Dustin Metzgar22-Jun-06 6:48
Dustin Metzgar22-Jun-06 6:48 
QuestionGraph to image Pin
Abel Castillo21-Jun-06 6:03
Abel Castillo21-Jun-06 6:03 
AnswerRe: Graph to image Pin
mikanu21-Jun-06 6:32
mikanu21-Jun-06 6:32 
GeneralRe: Graph to image Pin
Abel Castillo21-Jun-06 7:08
Abel Castillo21-Jun-06 7:08 
GeneralRe: Graph to image Pin
mikanu21-Jun-06 8:09
mikanu21-Jun-06 8:09 
GeneralRe: Graph to image [modified] Pin
Abel Castillo21-Jun-06 23:15
Abel Castillo21-Jun-06 23:15 
GeneralRe: Graph to image Pin
Abel Castillo22-Jun-06 0:57
Abel Castillo22-Jun-06 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.