Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8077463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:28:57+00:00 2026-06-05T15:28:57+00:00

I have a .gif file which i wish to use as the background image

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:29:00+00:00Added an answer on June 5, 2026 at 3:29 pm
    /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {
                System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
                this.button1 = new System.Windows.Forms.Button();
                this.SuspendLayout();
    
                //  this.button1.Image = new Bitmap(@"C:\images\dance.gif");
    
                // if you import the local resource 
                this.button1.Image = ((System.Drawing.Image)(resources.GetObject("button1.Image")));
                this.button1.ImageAlign = System.Drawing.ContentAlignment.TopRight;
                this.button1.Location = new System.Drawing.Point(109, 73);
                this.button1.Name = "button1";
                this.button1.Size = new System.Drawing.Size(523, 437);
                this.button1.TabIndex = 1;
                this.button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
                this.button1.UseVisualStyleBackColor = true;
                // 
                // Form1
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 17F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(807, 640);
                this.Controls.Add(this.button1);
                this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.Name = "Form1";
                this.Text = "Image In Button Control";
                this.ResumeLayout(false);
    
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .vss type file which I want to convert to an image
i have button, on a click of which i want to download the file
I have a Soft.CSS file which has following class .check_out { width:58px; background-image:url(/a/i/softadd/checkout.gif);} What
I have CSS with an image .backgroundImg { background: url('./path/file.gif'); background-repeat: no repeat; width:
I use google analytics which uses a file ga.js. This creates a hidden utm.gif
I have some jpg files i want to create gif animated from them. i
I have a php code which generate an gif-image defined by a set of
I have this code: <body onLoad=subcatSelection();> The function is inside a .js file which
I have a dynamic image, which I wish to serve looking like a static
i have a png file which must be converted to a gif file. There

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.