simple animation controlling c#/windows forms


i need strike out discerning animation c#/windows forms halloween display. only 2d shapes relocating plain background. given only discerning one-off digest i really don't wish exercise learn an whole new set collection this. (directx dev kits, silverlight, flash, etc..) i also have exercise churned computers anything over simple .net horizon (2.0) pain arse.



for collection i've got vs2k8, 25 years growth experience, wheelbarrow, pyre cloak, 2 days strike out. i haven't finished animation given controlling assembler atari 130xe (hooray page flipping player/missile graphics!)



advice? here's things i'd know:




  • i pull any lifeless widget (like panel) fiddling it's onpaint handler, right? that's i'd pull tradition widget. there improved technique this?

  • is there page-flipping technique kind thing windows forms? i'm looking high support rate, only small flicker/drawing necessary.



thanks.



post mortem correct ... "a integrate coding days later"



well, digest done. links next came permitted nonetheless integrate 404. (i wish grant some-more respond noted "correct"). biggest problem i overcome flickering, determined bug i attempted pull form directly.




  • using onpaint eventuality form: bad idea. i never got work; lots puzzling errors (stack s, argumentnullexceptions). i wound adult controlling quarrel sized fill form worked fine.

  • using onpaint slight delayed anyway. somewhere online i review building painteventargs slow, weren't kidding. lots flickering went divided i deserted this. skip onpaint/invalidate() only paint yourself.

  • setting "double buffering" options form still left nictitate fixed. (and i found opposing docs conspicuous "set control" "set form". good controls don't have .setstyle() method.) i haven't tested but them, competence doing something (this form):



        this.setstyle(controlstyles.userpaint, true);
    this.setstyle(controlstyles.optimizeddoublebuffer, true);
    this.setstyle(controlstyles.allpaintinginwmpaint, true);



so workhorse formula wound adult looking (pf quarrel control):



    vacant paintplayfield()
{
bitmap bufl = new bitmap(pf.width, pf.height);
controlling (graphics g = graphics.fromimage(bufl))
{
g.fillrectangle(brushes.black, new rectangle(0, 0, pf.width, pf.height));
drawitems(g);
drawmoreitems(g);
pf.creategraphics().drawimageunscaled(bufl, 0, 0);
}
}


and i only called paintplayfield inside timer loop. nictitate during all.



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?