public void pifu()
{
string tupian = comboBox1.Text;
if (tupian == "1")
{
this.BackgroundImage = Image.FromFile(@"1\1.jpg");
return;
}
if (tupian == "2")
{
this.BackgroundImage = Image.FromFile(@"1\2.jpg");
return;
}
if (tupian == "3")
{
this.BackgroundImage = Image.FromFile(@"1\3.jpg");
return;
}
if (tupian == "4")
{
this.BackgroundImage = Image.FromFile(@"1\4.jpg");
return;
}
if (tupian == "5")
{
this.BackgroundImage = Image.FromFile(@"1\5.jpg");
return;
}
}
这是我现在的代码,但是只能改一个窗体,改怎么建公共静态类?使我所有的窗体背景图片都能改?