-5

I Have a Picturebox in WinForm I want when mouse go on Picturebox gif play once How can i do that?

milad
  • 79
  • 10

1 Answers1

0

How do you show animated GIFs on a Windows Form (c#) explains how to enable and disable animation. Create procedures for to enable and disable animation. Consider letting a different thread (Backgroundworker? or maybe async-await) do the animation

Create event handlers to react on MouseEnter and Mouse Leave and enable and disable the animation.

Most neat solution: Create a class AnimatedPictureBox derived from a picture box or a user control that has a picture box on it and let this class react on MouseEnter / MouseLeave. Advantage: code is reusable and you can use the designer to put the AnimatedPictureBox on your form

Community
  • 1
  • 1
Harald Coppoolse
  • 28,834
  • 7
  • 67
  • 116