c# - How to avoid screen flickering? -


i making windows form application , screen divided between 3 parts like

===========================================================================                     top panel (it doesn't flicker) =========================================================================== ||         || 'it has panel & panel contains table layout,this tabble layout' ||         || 'has picture box , label, picture & text of label is'            ||         ||'changed on click of side bar menu' (prob: flickers lot) ||side bar ||============================================================== ||(doesn't ||'this part has panel , panel contains different table' ||flicker) ||'layouts , on click of menu, related table layout shown and'   ||         ||'some of parts of table layout created dynamically.' ||         ||            ||         ||                (prob: flickers lot) ||         || 

i searched lot , found solution everywhere , tried this

public constructor()     {         initializecomponent();         this.setstyle(controlstyles.optimizeddoublebuffer, true);         this.doublebuffered = true;         doublebuffered = true;         setstyle(controlstyles.userpaint |                       controlstyles.allpaintinginwmpaint |                       controlstyles.resizeredraw |                       controlstyles.containercontrol |                       controlstyles.optimizeddoublebuffer |                       controlstyles.supportstransparentbackcolor                       , true);     } 

i tried this

protected override createparams createparams { { createparams handleparam = base.createparams; handleparam.exstyle |= 0x02000000;   // ws_ex_composited        return handleparam; } } 

it changes whole background of screen black color.

but still problem remains same, can tell me how solve problem , doing mistake ? lot in advance.

without more go on, gut says either adding lot of data areas or there lot of resizing going on.

try anywhere update screen ( adding rows listviews/boxes/etc ) or resize screen, or else cause screen redraw. ex:

public void something_resize(object sender, eventargs e) {     try     {         this.suspendlayout();           // update, add data, redraw, w/e.          // add listviews , boxes etc in batches if can, not item item.       }     catch     {     }         {         this.resumelayout();      } }  

its important put resumelayout() call in block, because if exception occurs w/e reason, want window layout, regardless of exception.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -