Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Change the size od MDI container in the parent form

Change the size od MDI container in the parent form

Scheduled Pinned Locked Moved Visual Basic
dockerquestion
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sohaib_a
    wrote on last edited by
    #1

    Hello, How can you change the size of the MDI container in a MDI parent form?

    D 1 Reply Last reply
    0
    • S sohaib_a

      Hello, How can you change the size of the MDI container in a MDI parent form?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      The control is MdiClient. You just need to enumerate the Controls collection of the form, looking for a control of Type MdiClient. Then you need to turn off the Dock proeprty and set the position and size properties to whatever you need.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008

      S 1 Reply Last reply
      0
      • D Dave Kreskowiak

        The control is MdiClient. You just need to enumerate the Controls collection of the form, looking for a control of Type MdiClient. Then you need to turn off the Dock proeprty and set the position and size properties to whatever you need.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007, 2008

        S Offline
        S Offline
        sohaib_a
        wrote on last edited by
        #3

        Is this the way you mean,but it's not working.When maximize the parent form,the child form maximizes to the entire form.What is the problem? For Each ctrl As Control In Me.Controls If TypeOf ctrl Is MdiClient Then ctrl.Dock = DockStyle.None ctrl.Location = New System.Drawing.Point(1, 107) ctrl.Size = New System.Drawing.Size(769, 434) End If Next

        D 1 Reply Last reply
        0
        • S sohaib_a

          Is this the way you mean,but it's not working.When maximize the parent form,the child form maximizes to the entire form.What is the problem? For Each ctrl As Control In Me.Controls If TypeOf ctrl Is MdiClient Then ctrl.Dock = DockStyle.None ctrl.Location = New System.Drawing.Point(1, 107) ctrl.Size = New System.Drawing.Size(769, 434) End If Next

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          That code works fine and as expected, though I'd probably add an Exit For before the End If. If you're saying that the title bar for the child form takes up the entire width of the patent form, this is the expected behavior and you can't turn it off. If you're saying that if you maximize the parent form and this causes the child form to maximize also, then something in your code is causing this. The code you posted will not do cause that problem to happen.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups