Results 1 to 18 of 18

Thread: [2005] MDI child area size

  1. #1

    Thread Starter
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    [2005] MDI child area size

    I want to use a MDI-form as a container for forms with no border. Therefore these forms must fit in the child area of the MDI-parent (without any appearing scrollbars). How to get this size?

  2. #2
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: [2005] MDI child area size

    You could set their dockstyle to fill after instantiating them.
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  3. #3
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: [2005] MDI child area size

    Code:
    Dim frm As Form
    frm.MdiParent = me
    frm.show()
    frm.dockstyle = dockstyle.fill
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] MDI child area size

    It sounds to me like you should be using a regular form and UserControls rather than an MDI interface. Would you care to elaborate on the scenario?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: [2005] MDI child area size

    JM, I have a similar application where I use an MDI container with a customer ToolBar. The balance of the MDI container is used to open Children without borders so the GUI looks more fluid (Just my opinion).
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  6. #6

    Thread Starter
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: [2005] MDI child area size

    Quote Originally Posted by jmcilhinney
    It sounds to me like you should be using a regular form and UserControls rather than an MDI interface. Would you care to elaborate on the scenario?
    Well I want to encapsulate functionality in each form. Each form has a certain function.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] MDI child area size

    Quote Originally Posted by namrekka
    Well I want to encapsulate functionality in each form. Each form has a certain function.
    A UserControl can have a certain function just as easily as a form.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: [2005] MDI child area size

    Quote Originally Posted by circuits2
    You could set their dockstyle to fill after instantiating them.
    VB Code:
    1. frm.Dock=DockStyle.Fill
    This works, however what if I want 2 form next to each other (glued together)

  9. #9

    Thread Starter
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: [2005] MDI child area size

    Quote Originally Posted by jmcilhinney
    A UserControl can have a certain function just as easily as a form.
    The forms are containing to much code. I want to use the same style as I did before in VB6 app's.

  10. #10
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: [2005] MDI child area size

    If forms have too much code, and you want more than one open, perhaps you need to use JM's idea and use a UserControl for each.
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] MDI child area size

    Quote Originally Posted by namrekka
    The forms are containing to much code. I want to use the same style as I did before in VB6 app's.
    Forget VB6. This is VB.NET and it's not the same thing. If the situation is best served by UserControls then UserControls is what you should use. Of course, you can do whatever you want but doing something because its what you did in VB6 is just plain illogical. Why did you switch to VB.NET if you want to do things the VB6 way? You changed, I would imagine, because VB.NET offered advantages, but if you insist on doing things the way you used to then you're ignoring some of those advantages. If VB.NET offers a better way to do something then I'd suggest that you use it. For instance, two UserControls in a TableLayoutPanel will give you the side-by-side thing and maintain the relative dimensions even if the form is resized. With forms you'd have to do a lot more of the work manually. Fight progress if you want but I don't see the point.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  12. #12

    Thread Starter
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: [2005] MDI child area size

    Sorry jmcilhinney but what I mean with "the same style as I did before in VB6 app's" is how it looks like for the user.
    What I mean with "The forms are containing to much code" is that they contain to much code for using it in a control and I don't want to reuse.

  13. #13
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: [2005] MDI child area size

    If you used forms (or a UserControl), what would you be putting in it/them? How many different forms/UserControls do you have to choose from? Could you get away with using panels?
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  14. #14

    Thread Starter
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: [2005] MDI child area size

    The current app I talk about had a total 40k lines of code divided over 45 forms and a ca 50 classes. This a app in VB6. Now a "sort of the same" application needs to be created in VS2005. I, and others, did like the appearance of the other application and for the new one I like to use the same style.
    Could you get away with using panels?
    Panels can be used. But can't encapsulate data. Perhaps I have to think it over.

  15. #15
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: [2005] MDI child area size

    If you used forms before, then the easiest conversion or duplication is going to be using forms again. Especially when your application depends on events inside the forms. On the flip side, you still didn't answer the question of what is on the forms. Therefore, your answer to that question may lead you right back the JM's suggestion of using UserControls.
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  16. #16
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [2005] MDI child area size

    Quote Originally Posted by namrekka
    I want to use a MDI-form as a container for forms with no border. Therefore these forms must fit in the child area of the MDI-parent (without any appearing scrollbars). How to get this size?
    From a child form, you can get its mdiparent clientsize. Use this info to set your child form's width and height.
    VB Code:
    1. MsgBox(Me.MdiParent.ClientSize.ToString)

  17. #17

    Thread Starter
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: [2005] MDI child area size

    Quote Originally Posted by stanav
    From a child form, you can get its mdiparent clientsize. Use this info to set your child form's width and height.
    Thanks this info works!

  18. #18

    Thread Starter
    Fanatic Member namrekka's Avatar
    Join Date
    Feb 2005
    Location
    Netherlands
    Posts
    639

    Re: [2005] MDI child area size

    Quote Originally Posted by circuits2
    you still didn't answer the question of what is on the forms
    I don't see the reason to tell what is on the 45 forms. I told that forms are not used for reuse but only for encapsulating functionality. Each form is different from the other. 1 form for video capture. 1 form for interact and measuring the image, 1 form with profiles, etc. So what is the advantage of using a usercontrol then?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width