Mdi Child Size

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel

    #1

    Mdi Child Size

    Why does VB ignore my width and height settings of my Mdi child form.

    I have a parent form. On the left is a treeview with a splitter. I
    want to open a child form up in the remaining space and size the
    controls on it according to the width of the main form. So:

    On the parent form:

    Dim myFrm2 as Frm2

    Frm2.MdiParent = Me
    Frm2.Show()


    On the child Form:
    Private Sub Frm2_SizeChange d(ByVal sender As Object, ByVal e As
    System.EventArg s) Handles MyBase.SizeChan ged


    Listbox1.Width = Me.Width - 25
    Listbox1.Height = Me.Height - 25

    End Sub


    What this does is resize the control to the size of the parent form not
    the child form. Any ideas????

    --

    Daniel
    MCSE, MCP+I, MCP in Windows 2000/NT

    --------------------------------------
    remove the 2nd madrid from my mail address to contact me.
  • Daniel

    #2
    Re: Mdi Child Size

    Daniel wrote:[color=blue]
    > Why does VB ignore my width and height settings of my Mdi child form.
    >
    > I have a parent form. On the left is a treeview with a splitter. I
    > want to open a child form up in the remaining space and size the
    > controls on it according to the width of the main form. So:
    >
    > On the parent form:
    >
    > Dim myFrm2 as Frm2
    >
    > Frm2.MdiParent = Me
    > Frm2.Show()
    >
    >
    > On the child Form:
    > Private Sub Frm2_SizeChange d(ByVal sender As Object, ByVal e As
    > System.EventArg s) Handles MyBase.SizeChan ged
    >
    >
    > Listbox1.Width = Me.Width - 25
    > Listbox1.Height = Me.Height - 25
    >
    > End Sub
    >
    >
    > What this does is resize the control to the size of the parent form not
    > the child form. Any ideas????
    >[/color]

    This must be simple. Something I am overlooking ro doing wrong. I have
    looked at the ClientSize property but still no luck. Any ideas?

    --

    Daniel
    MCSE, MCP+I, MCP in Windows 2000/NT

    --------------------------------------
    remove the 2nd madrid from my mail address to contact me.

    Comment

    • Mick Doherty

      #3
      Re: Mdi Child Size

      On my system, the steps you showed result in exactly the behaviour I would
      expect, and not what you describe, but why do you not just anchor the
      listbox instead of manually resizing?

      --
      Mick Doherty
      Dotnetrix offers Nothing. Standard and Premium versions available.



      "Daniel" <daniel@madridm adridsoleado.co m> wrote in message
      news:%23kiV%23w tgFHA.3436@tk2m sftngp13.phx.gb l...[color=blue]
      > Daniel wrote:[color=green]
      >> Why does VB ignore my width and height settings of my Mdi child form.
      >>
      >> I have a parent form. On the left is a treeview with a splitter. I want
      >> to open a child form up in the remaining space and size the controls on
      >> it according to the width of the main form. So:
      >>
      >> On the parent form:
      >>
      >> Dim myFrm2 as Frm2
      >>
      >> Frm2.MdiParent = Me
      >> Frm2.Show()
      >>
      >>
      >> On the child Form:
      >> Private Sub Frm2_SizeChange d(ByVal sender As Object, ByVal e As
      >> System.EventArg s) Handles MyBase.SizeChan ged
      >>
      >>
      >> Listbox1.Width = Me.Width - 25
      >> Listbox1.Height = Me.Height - 25
      >>
      >> End Sub
      >>
      >>
      >> What this does is resize the control to the size of the parent form not
      >> the child form. Any ideas????
      >>[/color]
      >
      > This must be simple. Something I am overlooking ro doing wrong. I have
      > looked at the ClientSize property but still no luck. Any ideas?
      >
      > --
      >
      > Daniel
      > MCSE, MCP+I, MCP in Windows 2000/NT
      >
      > --------------------------------------
      > remove the 2nd madrid from my mail address to contact me.[/color]


      Comment

      • Daniel

        #4
        Re: Mdi Child Size

        Mick Doherty wrote:[color=blue]
        > On my system, the steps you showed result in exactly the behaviour I would
        > expect, and not what you describe, but why do you not just anchor the
        > listbox instead of manually resizing?
        >[/color]

        Anchor the listbox...?

        So your system does not give the size of the parent form but that of the
        child?

        --

        Daniel
        MCSE, MCP+I, MCP in Windows 2000/NT

        --------------------------------------
        remove the 2nd madrid from my mail address to contact me.

        Comment

        • Daniel

          #5
          Re: Mdi Child Size

          Daniel wrote:[color=blue]
          > Mick Doherty wrote:
          >[color=green]
          >> On my system, the steps you showed result in exactly the behaviour I
          >> would expect, and not what you describe, but why do you not just
          >> anchor the listbox instead of manually resizing?
          >>[/color]
          >
          > Anchor the listbox...?
          >
          > So your system does not give the size of the parent form but that of the
          > child?
          >[/color]

          OK solved it. I had put the change in size in the SizeChanged event of
          the child. When I moved them to the Load event all was great. I guess
          the previous symptoms i was getting were down to user error.

          --

          Daniel
          MCSE, MCP+I, MCP in Windows 2000/NT

          --------------------------------------
          remove the 2nd madrid from my mail address to contact me.

          Comment

          Working...