c# - How to add animated gif to a button? -


Can you tell me how to add animation GIF to any button in C #. Just did not work very well by adding GIF as a resource and button image (the next frame apiece on the previous ones). The problem appears in a way that C # is treating transparency but I do not know how to fix it.

Thanks in advance.

--- Edit ---

After playing with GIF, this issue was with transparency in GIF. The next frame was drawn to the previous one so that the elements I wanted to be transparent in between the animation, just did not do it properly (they still have the color of the last frame). To cover the last frame was to solve white areas on the next frame, white was my transparent color, so everything looked fine after that :)

I hope someone will find this useful. Happy programming:

To do this, you need to do the following:

  1. Set the background image layout property to the center

  2. Set the image property of the button of your animated GIF.

This will work, because I have tested it, and it worked for me.

Edit: Designer code below:

  this.Button4.BackgroundImageLayout = System.Windows.Forms .ImageLayout.Center; This.Button4.Image = (System.Drawing.Image) resource. GetObject ("Button4.Image"); This.Button4.Location = new System.Drawing.Point (220, 329); This.Button4.Name = "Button4"; This.Button4.Size = New system Drawing. Size (81, 68); This.Button4.TabIndex = 4; This.Button4.Text = "Button4"; This.Button4.UseVisualStyleBackColor = True;  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -