记一次winfrom 面板改变背景图片
阅读原文时间:2023年07月08日阅读:1
 this.panel1.BackgroundImage = Image.FromFile(@"D:\TestDemo\WindowsFormsApp2\WindowsFormsApp2\黑箭头.png");
            this.panel1.BackgroundImageLayout = ImageLayout.Stretch;
            this.panel1.Tag = "img1";
            teleTimer.Elapsed += (o,k)=> {
                if (this.panel1.Tag.ToString() != "img1")
                {
                    this.panel1.BackgroundImage = Image.FromFile(@"D:\TestDemo\WindowsFormsApp2\WindowsFormsApp2\黑箭头.png");
                    this.panel1.BackgroundImageLayout = ImageLayout.Stretch;
                    this.panel1.Tag = "img1";
                }
                else
                {
                    this.panel1.BackgroundImage = Image.FromFile(@"D:\TestDemo\WindowsFormsApp2\WindowsFormsApp2\红箭头.png");
                    this.panel1.BackgroundImageLayout = ImageLayout.Stretch;
                    this.panel1.Tag = "img2";
                }
            };
            teleTimer.Start();

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章