Re: Change MDI BackColor

Mitch Denny <[email protected]> Thu, 20 Jun 2002 20:13:14 +1000
Newsgroups gmane.comp.windows.devel.dotnet.general
Organization MitchDenny
Message-ID <[email protected]>
Dinesh,

I believe someone actually posted a solution, but incase
you missed it this is probably along the same lines:

using MdiColour;
using System;
using System.Drawing;
using System.Windows;
using System.Windows.Forms;

namespace MdiColour
{

        public class EntryPoint : System.Windows.Forms.Form
        {

                public EntryPoint()
                {

                        // Set the form to be a MDI container then
enumerate
                        // the controls collection to find the
MdiClient, there
                        // is only ever one (in theory) MdiClient, when
it is
                        // found set its color to red. Note that it
isn't necessary
                        // to cast to MdiClient since its base "Control"
already
                        // supports a BackColor property.
                        this.IsMdiContainer = true;
                        foreach (Control control in this.Controls)
                        {

                                if (control is MdiClient)
                                {

                                        control.BackColor = Color.Red;

                                }

                        }

                }

                public static void Main()
                {

                        Application.Run(new EntryPoint());

                }

        }

}

Dinesh, if you did see the other same, the confusion you
might be experiencing is the class name "MdiClient" note
that this isn't actually a child form, it is the control
surface which actually hosts the forms.

----------------------------------------
- Mitch Denny
- [email protected]
- +61 (414) 610-141
-

-----Original Message-----
From: The DOTNET list will be retired 7/1/02
[mailto:[email protected]] On Behalf Of Dinesh Upare
Sent: Thursday, 20 June 2002 20:00
To: [email protected]
Subject: Re: [DOTNET] Change MDI BackColor


I think I could not put my question in right way.

My MDI Form does not have MDI Child but has a space where I could open a
Child form.

I am not able to change the color of that space, that space is MDI
Form's Background color and it is always Dark Grey, the other controls
on the MDI form does take the Background color if they are transperent.

I don't want't to put any background Image on the MDI Form.

Is there any solution for this?
Dinesh

----- Original Message -----
From: "Shishir Kumar Mishra" <[email protected]>
To: <[email protected]>
Sent: Thursday, June 20, 2002 2:39 PM
Subject: Re: [DOTNET] Change MDI BackColor


> Hi Dinesh !
> After  calling  InitializeComponent();
>
> write following code  in constructor
> foreach(Control con in this.Controls)
> {  if(con is MdiClient)
>   {  con.BackColor = this.BackColor;
>     con.BackgroundImage = this.BackgroundImage;
>   }
> }
>
> HTH...
> Shishir Kumar Mishra
> Agni Software (P) Ltd.
> www.agnisoft.com
> ----------------------------------
> Vidya Dadaati Viniyam
> ----------------------------------
>
>
>
> ----- Original Message -----
> From: "Dinesh Upare" <[email protected]>
> To: <[email protected]>
> Sent: Thursday, June 20, 2002 1:02 PM
> Subject: [DOTNET] Change MDI BackColor
>
>
> > Is there any way to change the back color of the MDI Parent form.
> >
> > If I set the back color property to any color only the controls on
> > the
MDI
> > Parent form reflects with the back color, but MDI Form doen not (It
> > is always Dark Grey).
> >
> > Can any body help me Out?
> >
> > Dinesh
> >
> > You can read messages from the DOTNET archive, unsubscribe from
> > DOTNET,
or
> > subscribe to other DevelopMentor lists at
> > http://discuss.develop.com.
> >
>
> You can read messages from the DOTNET archive, unsubscribe from
> DOTNET, or subscribe to other DevelopMentor lists at
> http://discuss.develop.com.
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.