Dear Seeker,
The original post is from this site. It is given in C++ and I’ve written the same for C#.Net.
http://support.microsoft.com/kb/816184/en-us?spid=1249&sid=122
Source Code to change the background colour of an MDI Form:
Copy and paste this code in MDI Form’s Load Event:
———————————–
private void frmMDI_Load(object sender, EventArgs e)
{
MdiClient ctlMDI;
// Loop through all the controls of the form controls looking for the control of type MdiClient.
IEnumerator iEnum = this.Controls.GetEnumerator();
while ( iEnum.MoveNext())
{
try
{
// Try to cast the control to type MdiClient.
System.Windows.Forms.Control pCtrl = (System.Windows.Forms.Control)iEnum.Current;
ctlMDI = (MdiClient)pCtrl;
}
catch ( InvalidCastException )
{
continue;
}
// Set the BackGround colour property of the MdiClient control.
ctlMDI.BackColor = this.BackColor;
break;
}
}
—————————————-
Happy Coding….