首先定义一个MdiClient变量
private System.Windows.Forms.MdiClient mdiClient;
在Mdi父窗体的构造函数中添加如下代码: //
//准备获取MdiClient
//
int iCnt=this.Controls.Count;
for(int i=0;i<this.Controls.Count;i++)
{
if(this.Controls[i].GetType().ToString()=="System.Windows.Forms.MdiClient")
{
this.mdiClient=(System.Windows.Forms.MdiClient)this.Controls[i];
break;
}
}
string fbImage = Application.StartupPath + "\\Images\\backGround.jpg";
if(File.Exists(fbImage))
{
Bitmap bm = new Bitmap(fbImage);
this.mdiClient.BackgroundImage = bm;
}
其中fbImage是你要设置的背景图片
//准备获取MdiClient
//
int iCnt=this.Controls.Count;
for(int i=0;i<this.Controls.Count;i++)
{
if(this.Controls[i].GetType().ToString()=="System.Windows.Forms.MdiClient")
{
this.mdiClient=(System.Windows.Forms.MdiClient)this.Controls[i];
break;
}
}
string fbImage = Application.StartupPath + "\\Images\\backGround.jpg";
if(File.Exists(fbImage))
{
Bitmap bm = new Bitmap(fbImage);
this.mdiClient.BackgroundImage = bm;
}