在父窗体加入一下代码就OK
public FrmMain()
{
InitializeComponent();
foreach (Control ctr in this.Controls)
{
if (ctr.GetType().ToString().Equals("System.Windows.Forms.MdiClient"))
{
((MdiClient)ctr).BackColor = Color.Pink;
}
}
}
==加入背景图片
try
14 {
15 string imagepath = Application.StartupPath + @"/Images/backGround.jpg";
16 foreach (Control ctr in this.Controls)
17 {
18 if (ctr.GetType().ToString().Equals("System.Windows.Forms.MdiClient") && (File.Exists(imagepath)))
19 {
20 ((MdiClient)ctr).BackgroundImage = new Bitmap(imagepath);
21 }
22 }
23
24 }
25 catch (Exception ex) { MessageBox.Show(ex.Message); }