Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Change background image of MDI form
 

Change background image of MDI form

Hi,

i have used the code in this thread:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3963519&SiteID=1

to set a background image for mdi form. but i have got color changed as result only, the background image didn't occur.

can anybody help what's wrong ?

Thanks,

Abdullah_001  Monday, October 13, 2008 12:45 PM

Hi Abdullah_001,

The code in that thread is used to set the backcolor and background image of MDIClient. I don’t know why you choose to use that code to change the background image of the parent form or child form. Actually we only need to set the BackgroundImage property of the form by designer or by code at runtime.

If you want to find the reason why that code can only change the backcolor of your form, but not the image. Probably you failed to set the BackgroundImage of the MDIClient, Please also note that the author of that post used resoure to set the BackgroudImage.

Just change the orginal code a little. Add this kind of statements, and see whether it helps.

Image img = Bitmap.FromFile(“FileName� make sure FileName should be full path if you use absolutly path. Such as “c:\\aa.jpg�

ctl.BackgroundImage = img.

Please don’t hesitate to tell me if your problem still can’t be solved.

Best Regards,

Bruce Zhou

Bruce.Zhou  Thursday, October 16, 2008 11:04 AM

Hi Abdullah_001,

The code in that thread is used to set the backcolor and background image of MDIClient. I don’t know why you choose to use that code to change the background image of the parent form or child form. Actually we only need to set the BackgroundImage property of the form by designer or by code at runtime.

If you want to find the reason why that code can only change the backcolor of your form, but not the image. Probably you failed to set the BackgroundImage of the MDIClient, Please also note that the author of that post used resoure to set the BackgroudImage.

Just change the orginal code a little. Add this kind of statements, and see whether it helps.

Image img = Bitmap.FromFile(“FileName� make sure FileName should be full path if you use absolutly path. Such as “c:\\aa.jpg�

ctl.BackgroundImage = img.

Please don’t hesitate to tell me if your problem still can’t be solved.

Best Regards,

Bruce Zhou

Bruce.Zhou  Thursday, October 16, 2008 11:04 AM
I have the same problem, I have tried to change the background image via the designer and from the code but nothing really happens. In both ways the background image isn't showing up, all I get is the colored background.

Supreme-Kai  Saturday, October 18, 2008 12:54 PM

You can use google to search for other answers

Custom Search

More Threads

• How to generate C# code automatically?
• Implementing hidden "content panel"...
• designhost sample - toolbox with controls of the same type
• The path is not of legal form...How do I know which path?
• How to create new property (cols,Rows) to DataGridView
• [solved] Display a designer form in an external application without freezing external application events
• Error loading string resource?
• How do I get the accesskey functionality to work in a Toolstrip container containing my custom component?
• Standalone GUI Designer Tool?
• Sorting CategoryAttributes for PropertyGrids