graphics - C# Panel is flickering. When I try CreateParams, the situation is much worse -


the title pretty says it. have panel inside of form. have lots of shapes in panel bounce off of each other. more shapes have worse flickering is. after searching on site awhile added constructor

    this.setstyle(controlstyles.allpaintinginwmpaint | controlstyles.userpaint      | controlstyles.doublebuffer, true); 

then found should add this

protected override createparams createparams {     {     createparams cp = base.createparams;     cp.exstyle |= 0x02000000;  // turn on ws_ex_composited (child control double-buffering)     return cp;   } } 

after added screen flickered worse. it's not fair flickered. of time blank , every once in while shapes flash briefly. code paint shapes looks this.

pnl.refresh(); graphics g = pnl.creategraphics(); for(int = 0; < numofshapes; i++) {     rectangle myrect = shapelist[i];     g.fillrectangle(new solidbrush(color.black), myrect); } 

edit:

i don't know why can't last bit of code right. sorry that. i'm refreshing panel looping through array of rectangles , painting them panel


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -