Click here to Skip to main content
16,007,858 members
Home / Discussions / C#
   

C#

 
GeneralRe: Find Largest #..... Pin
Eliee28-May-06 11:11
Eliee28-May-06 11:11 
GeneralRe: Find Largest #..... Pin
Colin Angus Mackay28-May-06 12:02
Colin Angus Mackay28-May-06 12:02 
AnswerRe: Find Largest #..... Pin
Guffa28-May-06 13:08
Guffa28-May-06 13:08 
AnswerRe: Find Largest #..... Pin
Danny van Kasteel28-May-06 23:05
Danny van Kasteel28-May-06 23:05 
QuestionVS 2005 flickering problem mouse leave Pin
Phoen2527-May-06 11:50
Phoen2527-May-06 11:50 
AnswerRe: VS 2005 flickering problem mouse leave Pin
martin_hughes27-May-06 12:30
martin_hughes27-May-06 12:30 
GeneralRe: VS 2005 flickering problem mouse leave Pin
Phoen2527-May-06 12:32
Phoen2527-May-06 12:32 
GeneralRe: VS 2005 flickering problem mouse leave Pin
Phoen255-Jul-06 9:44
Phoen255-Jul-06 9:44 
I found the problem ...

See this link:

http://www.dotnet247.com/247reference/msgs/42/214827.aspx

Yes, that is what I found. I hadn't seen the flickering before because my
form was too small.

However, this is true. The flickering occures when the underlaying window is
switched to "layered mode". Actually it flickers even if you set alpha to
255 (fully opaque).

Switching to layered mode involves three steps.
1. Checking the os version - it has to be NT 5 or latter
2. Set WS_EX_LAYERED window style
3. SetWindowLayeredAttributes this method is not defined in user32.dll for
versions before Win2k that's why first step is necessary.

When a Windows Forms control is created it is not a layered window. And it
switches to this mode when set the opacity to some value less then 1.

So my solution is to switch to layered mode in some early stage of the form
life. As soon as the form is created before to become visible. Otherwise
we'll see the flickering.

Javier is completely correct that the layered window has to be fully
redrawn. But it goes only when the window (form) resizes. You can still
invalidate some portions of the form and it will works how ot supposed to
work.
Layered window could even show better performance in some situations.
How internaly layered windows work is all painting is redirected to
off-screen buffer and when the painting's done alpha blending is applied to
the resulting picture and the result is drawn on the screen. This of course
is done internaly in windows and it uses the video card hardware support for
alpha blending if it has any.

Becuse all winodw is double buffered Windows doesn't send WM_PAINT when the
form is moved for example or when some part of the form is uncovered. In
such cases Windows uses double buffered image.
When children control is moved on the form it updates as much as it is
necessary. So the performance hit is not so big.

Anyway, my first solution that I was planning to post involved P\Invoke and
calling all API functions necessary to switch to "layered mode", but then I
found that if one set Opacity to value less then 1 and then return it back
to 1 the form class doesn't switch to the "normal mode" and leave the window
layered.

So the easiest way to get rid if this flickering is by overriding
OnControlCreated method and adding the following two lines:

this.Opacity = 0.9;
this.Opacity = 1;

No more flickering .

Thanks a lot people !!!



Questioninsert image to Sql Data base Pin
v_sadeghpour27-May-06 11:46
v_sadeghpour27-May-06 11:46 
AnswerRe: insert image to Sql Data base Pin
Judah Gabriel Himango27-May-06 16:58
sponsorJudah Gabriel Himango27-May-06 16:58 
AnswerRe: insert image to Sql Data base Pin
Billah27-May-06 18:58
Billah27-May-06 18:58 
GeneralRe: insert image to Sql Data base Pin
v_sadeghpour28-May-06 11:27
v_sadeghpour28-May-06 11:27 
Questionthrow Pin
mehrdadc4827-May-06 11:18
mehrdadc4827-May-06 11:18 
AnswerRe: throw [modified*2] Pin
Judah Gabriel Himango27-May-06 11:40
sponsorJudah Gabriel Himango27-May-06 11:40 
GeneralRe: throw Pin
Graham Nimbley27-May-06 11:56
Graham Nimbley27-May-06 11:56 
AnswerRe: throw Pin
Guffa27-May-06 12:12
Guffa27-May-06 12:12 
GeneralRe: throw Pin
Graham Nimbley27-May-06 12:53
Graham Nimbley27-May-06 12:53 
GeneralRe: throw Pin
Judah Gabriel Himango27-May-06 14:11
sponsorJudah Gabriel Himango27-May-06 14:11 
QuestionShockwaveObject Pin
mehrdadc4827-May-06 11:15
mehrdadc4827-May-06 11:15 
Questionsql weird problem Pin
JelleM27-May-06 10:45
JelleM27-May-06 10:45 
AnswerRe: sql weird problem Pin
Colin Angus Mackay27-May-06 11:15
Colin Angus Mackay27-May-06 11:15 
GeneralRe: sql weird problem Pin
JelleM27-May-06 11:26
JelleM27-May-06 11:26 
AnswerRe: sql weird problem Pin
Guffa27-May-06 12:09
Guffa27-May-06 12:09 
GeneralRe: sql weird problem Pin
JelleM28-May-06 0:43
JelleM28-May-06 0:43 
AnswerRe: sql weird problem Pin
Guffa28-May-06 10:55
Guffa28-May-06 10:55 

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.