|
-
Feb 17th, 2006, 09:10 PM
#1
Thread Starter
Lively Member
How To Change The Background On MDI Parent
How do I change the background on a MDI parent window?
The easy answer would be to set the background property of the form to whatever color but that doesnt work.
-
Feb 18th, 2006, 02:52 AM
#2
Re: How To Change The Background On MDI Parent
That's because you cannot see the background of the form because it is obscured by an MdiClient control. That's the grey area that you can see and what actually hosts the child forms. You are not supposed to access it directly so there is no member variable created. To get a reference to it you simply need to iterate over the Controls collection of the form until you find one that is an MdiClient.
Code:
public partial class Form1 : Form
{
private MdiClient childHost;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
foreach (Control ctl in this.Controls)
{
if (ctl.GetType() == typeof(MdiClient))
{
// This is the control that hosts the child forms.
this.childHost = (MdiClient)ctl;
break;
}
}
}
}
-
Feb 18th, 2006, 03:02 AM
#3
Re: How To Change The Background On MDI Parent
if you go way back to page 4 in the vb.net codebank, you will find an example of creating custom mdi background colours.
it's in vb.net, but very easy to translate over to C#.
the link is ... Custom Background Colours in MdiForm / MdiChild.
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Feb 21st, 2006, 04:27 AM
#4
Thread Starter
Lively Member
Re: How To Change The Background On MDI Parent
Perfect. Thanks alot guys
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|