Thursday, 15 May 2014

invalidate - What can cause a control to not be re-drawn in C# -



invalidate - What can cause a control to not be re-drawn in C# -

i utilize treeview display info winform , .net 4.5.. it's not repainted when add together node. in order forcefulness repaint, utilize this.invalidates() , this.update() it's not working. added painteventhandler in order see if paint() called :

defaultconstructor(){ [...] this.paint += new painteventhandler(this.onthispaint); } private void onthispaint(object sender, system.windows.forms.painteventargs e) { console.writeline("repaint"); } private void updatetree() { //some fabulous code console.writeline("updating tree"); seek { this.invalidate(); this.update(); } grab (exception) { console.writeline("error in invalidate"); throw; } }

and paint not called, cause wrong display. no error thrown when command isn't repainted.

edit :

here's output :

'sakura.ui.vshost.exe' (managed (v4.0.30319)): loaded 'microsoft.generatedcode' bubble graph // <- start of treeview cycle graph line graph flw_oilconc_graph spec_oilconc_graph workingexample stacked graph elr_smoke_test total load p.1 spec_oil_graph table table apm table dura // <- start of treeview invalidated repaint 'sakura.ui.vshost.exe' (managed (v4.0.30319)): loaded 'c:\tfs\2014\source_lys\source-1\sakura ii\projects\sakura.ui\bin\debug\sakura.ui.reporting.dll', symbols loaded. 'sakura.ui.vshost.exe' (managed (v4.0.30319)): loaded 'microsoft.generatedcode' 'sakura.ui.vshost.exe' (managed (v4.0.30319)): loaded 'c:\tfs\2014\source_lys\source-1\sakura ii\projects\sakura.ui\bin\debug\sakura.datacoordinating.dll', symbols loaded. 'sakura.ui.vshost.exe' (managed (v4.0.30319)): loaded 'c:\tfs\2014\source_lys\source-1\sakura ii\projects\sakura.ui\bin\debug\sakura.reporting.dll', symbols loaded. invalidated 'sakura.ui.vshost.exe' (managed (v4.0.30319)): loaded 'c:\program files\volvo powertrain\sakura\evaluations\sakura.eval.dll', symbols loaded. 'sakura.ui.vshost.exe' (managed (v4.0.30319)): loaded 'microsoft.generatedcode' repaint repaint bubble graph // <- start of treeview cycle graph line graph flw_oilconc_graph spec_oilconc_graph unworkingexample // <- undisplayed node workingexample stacked graph elr_smoke_test total load p.1 spec_oil_graph table table apm table dura // <- end of treeview invalidated thread 'vshost.runparkingwindow' (0x1620) has exited code 0 (0x0). thread '<no name>' (0xed4) has exited code 0 (0x0).

what can cause such behavior ?

due poor implementation, command displayed not 1 modified. that's why paint not called.

c# invalidate

No comments:

Post a Comment