Animations: Sliding & Fading controls on a C# form (winforms)

前端 未结 5 1182
甜味超标
甜味超标 2020-12-08 11:43

I\'m trying to implement a way to animate (translate, fade) controls around (more than one at the same time possibly) elegantly. For example, lets say I had a picture in the

5条回答
  •  眼角桃花
    2020-12-08 12:05

    I recommend that you switch to WPF; that would make it far easier.

    It is completely impossible to fade controls in WinForms; Windows controls cannot have opacity.
    The closest you can get would be to render the control and its area on the form to a pair of bitmaps, then crossfade the bitmaps in a PictureBox using a ColorMatrix.

    To slide controls in WinForms, you can use a Timer to gradually change the Top and/or Left properties of the controls and move them across the form. However, you'll get an annoying flicker, which is (AFAIK) impossible to remove.

提交回复
热议问题