C#中OpenFileDialog

来源:百度知道 编辑:UC知道 时间:2024/05/09 20:37:41
我想用这个控件把选中的图片作为FROM的背景,该怎么弄。

可以啊~
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
this.BackgroundImage = new Bitmap(ofd.FileName);
}
}