I have a .gif file which i wish to use as the background image for a button. The main reason i want to do this (as i know some of you will wonder why i want to do it this way) is because, a button relates to an instance of a class, and i want to monitor these classes. when a class (and therefore button) goes into an "alarmed" state, i wish i use these animated gif. i've tried;
mainUI.Controls["btn" + device.deviceButtonNumber].BackgroundImage = (System.Drawing.Image)Properties.Resources.red_orange;
But it is to my understanding that .BackgroundImage does not support animated gifs. i've tried a few suggestions throughout stackoverflow and non of these seem to work for me, such as setting BackgroundImageLayout to center and such.
I suppose as a last resort i could get it to cycle through the images manually as if it were a gif, but this would create more work and i'd like to keep things simple. Any suggestions?
edit: sorry, forgot to add, this is in Winforms.
edit 2:
for example. when i create my buttons dynamically, like so;
Button btnAdd = new Button();
btnAdd.Text = mDevices[i].deviceDescription;
btnAdd.Location = new Point(mDevices[i].deviceXPos.Value, mDevices[i].deviceYPos.Value);
I can still access:
btnAdd.Image <- note i can access image.
then when i come to modify them later from another thread, i find them like so;
mainUI.Controls["btn" + device.deviceButtonNumber].text = blah blah
mainUI.Controls["btn" + device.deviceButtonNumber].Location = blah blah
however i CANNOT access;
mainUI.Controls["btn" + device.deviceButtonNumber].Image