Hi dmy,
You may try putting this statement ,
this.Height = this.MdiParent.ClientSize.Height;
in your On_Activate event handler of your MDI child form.
If you still have problem, please let me know.
Thanks!
Best regards,
Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!
--------------------
| From: "dm_dal" <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
| Subject: Re: MdiParent Issue
| Date: Mon, 29 Sep 2003 08:07:32 -0500
| Lines: 49
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: mail.ebellgroup.com 63.121.243.2
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:53378
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| It's being called in the frm2 constructor, right after the call to
| InitializeComponent()
|
| I'm placing two custom controls on frm2 (the first is a custom panel with
a
| lable and combobox, it's Dock property is set to DockStyle.Top, the second
| is a third-party control who's height is determined by the containers
| ClientSize.Height). The issue is when I initialize the form, The third
party
| control fills the form height and the custom panel is overlaid on top of
the
| third party control. However, if I resize my form when it's running, the
| third party control adjust it's size (as it should) and is no longer under
| the panel control (this is correct behavior).
|
| So, I figured if I could set frm2's height to samller than I want it
| (design-time) then resize it during initization (run-time) then the that
| would compensate for the incorrect sizing.
|
| dmy
| | > "dm_dal" <
[email protected]> scripsit:
| > > I have a c# windows application that I'm working on. The main window
| > > (frmMain) IsMdiContainer is set to true. I have a second form (frm2)
| that
| > > is instantiated as a MdiChild form.
| > >
| > > frm2 is instantiated like thus:
| > >
| > > private void initChildForms()
| > > {
| > > Form myForm = new frm2();
| > > myForm.MdiParent = this;
| > > myForm.Show();
| > > }
| > >
| > > My issue is that within frm2, when I try to set
| > >
| > > this.Height = this.MdiParent.ClientSize.Height;
| > >
| > > I get a null exception (MdiParent is null). How else can I get the
| > > MdiParents ClientSize.Height ?
| >
| > Where are you calling the code that gets the client size?
| >
| > --
| > Herfried K. Wagner
| > MVP · VB Classic, VB.NET
| > <
http://www.mvps.org/dotnet>
|
|
|