Home All Groups Group Topic Archive Search About

MDIParent and MaximizedBounds bug(?)

Author
17 Mar 2006 10:57 PM
imnotamib
Howdy!

I'm trying to build an MDI application.
I've added a 'toolbox' navigation control down the left inside of the parent
form.
Now I need to change the child forms so they do not hide behind the toolbox
when maximized.
I am trying to use .MaximizedBounds but its bugged. =(
Do any of my fantastic peers have any suggestions?


To better understand the issue, do me a favor and try the following:

STEP 1: Make a new project

STEP 2: Add Form1 and Form2

STEP 3: Add this code to Form1:
Private Sub Form1_Load()
Me.IsMdiConatiner = True
Dim Child1 as new Form2
Child1.Visible = True
Dim Child2 as New Form2
Child2.MIDParent = Me
Child2.Visible = True
End Sub

STEP 4: Add this code to Form2:
Private Sub Form2_Load()
Me.MaximizedBounds = New System.Drawing.Rectangle (25, 25, 200, 200)
End Sub

STEP 5: Run it

Notice how Child1 will comply with the MaximizedBounds setting.
Notice how Child2 ignores the MaximizedBounds setting.

Author
22 Mar 2006 9:25 PM
imnotamib
Bumping for great justice

Show quoteHide quote
"imnotamib" wrote:

> Howdy!
>
> I'm trying to build an MDI application.
> I've added a 'toolbox' navigation control down the left inside of the parent
> form.
> Now I need to change the child forms so they do not hide behind the toolbox
> when maximized.
> I am trying to use .MaximizedBounds but its bugged. =(
> Do any of my fantastic peers have any suggestions?
>
>
> To better understand the issue, do me a favor and try the following:
>
> STEP 1: Make a new project
>
> STEP 2: Add Form1 and Form2
>
> STEP 3: Add this code to Form1:
> Private Sub Form1_Load()
>  Me.IsMdiConatiner = True
>  Dim Child1 as new Form2
>  Child1.Visible = True
>  Dim Child2 as New Form2
>  Child2.MIDParent = Me
>  Child2.Visible = True
> End Sub
>
> STEP 4: Add this code to Form2:
> Private Sub Form2_Load()
>  Me.MaximizedBounds = New System.Drawing.Rectangle (25, 25, 200, 200)
> End Sub
>
> STEP 5: Run it
>
> Notice how Child1 will comply with the MaximizedBounds setting.
> Notice how Child2 ignores the MaximizedBounds setting.
Author
22 Mar 2006 10:05 PM
Armin Zingler
Show quote Hide quote
"imnotamib" <imnota***@discussions.microsoft.com> schrieb
> Howdy!
>
> I'm trying to build an MDI application.
> I've added a 'toolbox' navigation control down the left inside of
> the parent form.
> Now I need to change the child forms so they do not hide behind the
> toolbox when maximized.
> I am trying to use .MaximizedBounds but its bugged. =(
> Do any of my fantastic peers have any suggestions?
>
>
> To better understand the issue, do me a favor and try the following:
>
> STEP 1: Make a new project
>
> STEP 2: Add Form1 and Form2
>
> STEP 3: Add this code to Form1:
> Private Sub Form1_Load()
> Me.IsMdiConatiner = True
> Dim Child1 as new Form2
> Child1.Visible = True
> Dim Child2 as New Form2
> Child2.MIDParent = Me
> Child2.Visible = True
> End Sub
>
> STEP 4: Add this code to Form2:
> Private Sub Form2_Load()
> Me.MaximizedBounds = New System.Drawing.Rectangle (25, 25, 200, 200)
> End Sub
>
> STEP 5: Run it
>
> Notice how Child1 will comply with the MaximizedBounds setting.
> Notice how Child2 ignores the MaximizedBounds setting.



Right, because it's an MDI child. It's maximized to the size of the
MDIContainer.


Armin
Author
22 Mar 2006 10:30 PM
Armin Zingler
Show quote Hide quote
"Armin Zingler" <az.nospam@freenet.de> schrieb
> "imnotamib" <imnota***@discussions.microsoft.com> schrieb
> > Howdy!
> >
> > I'm trying to build an MDI application.
> > I've added a 'toolbox' navigation control down the left inside of
> > the parent form.
> > Now I need to change the child forms so they do not hide behind
> > the toolbox when maximized.
> > I am trying to use .MaximizedBounds but its bugged. =(
> > Do any of my fantastic peers have any suggestions?
> >
> >
> > To better understand the issue, do me a favor and try the
> > following:
> >
> > STEP 1: Make a new project
> >
> > STEP 2: Add Form1 and Form2
> >
> > STEP 3: Add this code to Form1:
> > Private Sub Form1_Load()
> > Me.IsMdiConatiner = True
> > Dim Child1 as new Form2
> > Child1.Visible = True
> > Dim Child2 as New Form2
> > Child2.MIDParent = Me
> > Child2.Visible = True
> > End Sub
> >
> > STEP 4: Add this code to Form2:
> > Private Sub Form2_Load()
> > Me.MaximizedBounds = New System.Drawing.Rectangle (25, 25, 200,
> > 200) End Sub
> >
> > STEP 5: Run it
> >
> > Notice how Child1 will comply with the MaximizedBounds setting.
> > Notice how Child2 ignores the MaximizedBounds setting.
>
>
>
> Right, because it's an MDI child. It's maximized to the size of the
> MDIContainer.


I forgot to say:

If you dock your navigation control within the MDI parent, the child is not
hidden behind the control, even if it is maximized.


Armin