C# .NET - Mdi form - Asked By suresh kotte on 20-May-12 10:35 AM

Earn up to 10 extra points for answering this tough question.
Hi Every one,

          How to set mdi form background image in windows application. Plz give the best Example.



Thanks
Suresh
[)ia6l0 iii replied to suresh kotte on 20-May-12 01:42 PM
Load an image from file and set it to the BackGroundImage property of the mdi form instance.  Add this at a suitable place like the mdi form load event.

Hope it helps.
dipa ahuja replied to suresh kotte on 20-May-12 03:07 PM
Set the backgroundImage property or from code behind set :

public void SetImage()
{
    this.BackgroundImage = null;
    this.BackgroundImage = Image.FromFile(@"d:\2.jpg");
}
 
Jitendra Faye replied to suresh kotte on 21-May-12 12:09 AM
For this you need to set BackGroundImage property of MDI form, set like this-



TRy this and let me know.
Reena Jain replied to suresh kotte on 21-May-12 03:48 AM
Hi,

Once I had the same requirement, so when i have checked the property of form it having the same property as other form only difference comes when i select IsMDI=true. So there is a property with the name of Backgroundimage. You can set it directly from property window or like this
on the MDIForm_Load event :

Me.Dock = DockStyle.Fill
Me.Backgroundimage =Me.backgroundimage.FromFile ("d:\backimage.jpg")

I will suggest you to set only background image or color, don't set the control on mdi form. MDI from work as container for all other forms and behave like a parent window. The parent Form may not contain any controls. While the parent Form is open in design mode, the icons on the ToolBox are not displayed, but you can't place any controls on the Form. The parent Form can, and usually has its own menu.
Hope this will help you