简体   繁体   中英

How to animate a winforms custom control in C# without flickering?

I am looking for some help on how to animate a winforms custom control, the animations are simple fade-in fadeout or something a like an accordion style animation.

Can you please suggest any articles or code related to this.

It's called the DoubleBuffer property ( MS documentation ).

Here's an example .

Yep, use DoubleBuffer. A couple of tips I remember picking up:

  • Don't do anything other than copy a back buffer to the control in the control's paint method.

  • Handle refresh of the control in an independent thread.

  • Don't call refresh from any event handlers that modify the control! :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM