> 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
[quoted text clipped - 15 lines]
> I get a null exception (MdiParent is null). How else can I get the
> MdiParents ClientSize.Height ?

Signature
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet
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" <dmy75252@yahoo.com> scripsit:
> > I have a c# windows application that I'm working on. The main window
[quoted text clipped - 18 lines]
>
> Where are you calling the code that gets the client size?
Ying-Shen Yu[MSFT] - 30 Sep 2003 03:50 GMT
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" <dmy75252@yahoo.com>
| References: <e7eyB1HhDHA.1280@TK2MSFTNGP12.phx.gbl>
<isnetsn3.fsf@m.gmx.at>
| Subject: Re: MdiParent Issue
| Date: Mon, 29 Sep 2003 08:07:32 -0500
[quoted text clipped - 8 lines]
| 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
|
[quoted text clipped - 38 lines]
| >
| > Where are you calling the code that gets the client size?