首页 > 其他分享 >记一次winfrom 面板改变背景图片

记一次winfrom 面板改变背景图片

时间:2022-11-30 18:46:02浏览次数:35  
标签:Stretch winfrom BackgroundImageLayout TestDemo Tag WindowsFormsApp2 panel1 面板 背景


 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();

标签:Stretch,winfrom,BackgroundImageLayout,TestDemo,Tag,WindowsFormsApp2,panel1,面板,背景
From: https://www.cnblogs.com/SYF--BLOG/p/16939406.html

相关文章