怎样更新窗口应用程序的背景啊!
请问哪位知道,窗口应用程序中背景能不能像windows桌面一样可以由用户自己用自己的图片啊!
private void mnuBackPic_Click(object sender,EventArgs e)
{
if(MessageBox.Show("是否更换背景图片?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.Yes)
{
OpenFileDialog of=new OpenFileDialog();
string filename=of.FileName;
this.BackgroundImage=System.Drawing.Image.FromFile(filename);
}
}
OpenFileDialog of=new OpenFileDialog();
if(of.ShowDialog() == DialogResult.OK)
{
string filename=of.FileName;
try
{
this.BackgroundImage = System.Drawing.Image.FromFile(filename);
}
catch(Exception ex)
{
string errormsg = ex.Message;
MessageBox.Show(errormsg);
}
}
这个才对