Article View: borland.public.csharpbuilder.language.csharp
Article #444Re: Why is MDI Parent's Controls always on top of MDI child?
From: Marc Rohloff TeamB
Date: Fri, 21 Oct 2005 22:24
Date: Fri, 21 Oct 2005 22:24
44 lines
2340 bytes
2340 bytes
On 21 Oct 2005 09:15:44 -0700, Peter Jone wrote:
> Hi,
>
> I am developing an MDI application. Let's say I place a
> background image in the ParentForm. But when I show a
> ChildForm, the ParentImage is always on top of the Child. I
> tried ChildForm.BringToFront(), but then the ParentImage
> becomes invisible.
This is the way MDI works. Most people recommend against using it
since it is so quirky. Even Microsoft Office no longer uses it.
If you want a custom background then get an instance of the MDIClient
class, something like:
Control c;
MdiClient mc;
foreach c in Controls
{
mc := c as MdiClient;
if (mc != null)
{
//Do stuff with MdiClient mc
return;
}
}
For example:
mc.BackColor =
or
mc.BackgroundImage =
if you want something more advanced you have to assign an event
handler for the 'Paint' event.
--
the normal way to do this is to override the Paint method on the MDI
parent window
--
Marc Rohloff [TeamB]
marc rohloff -at- myrealbox -dot- com
Technical Details
Message-ID:
<pgkr2u5hk241$.dlg@marcrohloff.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!meganewsservers.com!feeder2.on.meganewsservers.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<43591430$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,d518cff07d88933a X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Marc Rohloff [TeamB]" <"on request"> Subject: Re: Why is MDI Parent's Controls always on top of MDI child? Newsgroups: borland.public.csharpbuilder.language.csharp User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit References: <43591430$1@newsgroups.borland.com> Date: Fri, 21 Oct 2005 18:24:18 -0400 Message-ID: <pgkr2u5hk241$.dlg@marcrohloff.com> X-Face: "huzh55Xi]!ZNni78>a*5+).`SK?<^q2MlHk-C]Z2M9T@\J5ZCB$95Ey+s"XQuhGFA[eutZ :0^AV!Q;t>gE`1-=8d;HZ6~*o1dH<X9\b$!|(}+I'!Xq)@3Op}%0ArW&nf'Qh*EwR X-Antivirus: avast! (VPS 0542-5, 10/21/2005), Outbound message X-Antivirus-Status: Clean NNTP-Posting-Host: 65.31.9.204 X-Trace: newsgroups.borland.com 1129933009 65.31.9.204 (21 Oct 2005 15:16:49 -0700) Lines: 44 X-Authenticated-User: mrohloff Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!meganewsservers.com!feeder2.on.meganewsservers.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail