Results 1 to 10 of 10

Thread: MDI behavior is strange. please help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2004
    Posts
    22

    Angry MDI behavior is strange. please help

    Is there away to prevent an MDI child form from being auto maximized?

    The problem I have is this. I have an mdi application that contains 2 mdi child forms. When I show the first form and maximize it so that it fills the mdi window I can't load the second form non maximized.

    Vb.net automatically maximizes the second form despite the fact that I didn't tell it too! If I then restore the second form to its normal size it then does the same with the first form. This is all very strange to me. When you maximize one form inside an MDI window it maximizes them all. how do you stop this from happening?

    What I want is the first form to stay maximized and the second for to appear on top not maximized.

    here is the code I'm using to display the second form (the one I don't want to be maximized)

    I'm loading this form from the menu so 'ME' is the MDI Parent form

    Dim frm As frm2
    frm = New frm2
    frm.MdiParent = Me
    frm.Show()

    When I click on the menu and execute the code above I have the first form maximized. I don't want this to happen. I want frm2 to appear inside the MDI form and I don't want it to be maximized.

    I've tried changing the window style but that dosn't work either. I also don't want to call frm2.ShowDialog() because it makes the form appear outside the MDI window.

  2. #2
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    I'm afraid this is normal windows behaviour, and there's probably nothing to do about it.

    You will see the same behaviour in all other MDI app's like Excel, Word and the like.

    Maybe some fancy API, but that's beyond me.

    Sorry.
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  3. #3
    Hyperactive Member CyberHawke's Avatar
    Join Date
    May 2004
    Location
    Washington DC
    Posts
    477
    As pax explained, the behavior is normal for all windows applications that use an MDI interface. You could get around this by not making the form you want to appear as normal, not an MDI child.
    Whadayamean it doesn't work....
    It works fine on my machine!

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    "What I want is the first form to stay maximized and the second for to appear on top not maximized. "


    You could reset the sizes of the child forms to achieve this effect as required and not use maximise.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  5. #5
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539
    cant you just set maximized size property???? not 100% sure but would it be the case that the max size is 100x100 if perant forms i maximised then it will only show child at max size
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  6. #6
    Hyperactive Member CyberHawke's Avatar
    Join Date
    May 2004
    Location
    Washington DC
    Posts
    477
    Well, three solutions have been offered, lets see what our friend who posted this question has to say about them. So tell us Kevin, what do you think?
    Whadayamean it doesn't work....
    It works fine on my machine!

  7. #7
    Fanatic Member
    Join Date
    Sep 2005
    Location
    Toledo, OH
    Posts
    785

    Re: MDI behavior is strange. please help

    As far as i am aware, the data in this thread is in correct. The form can be set to not maximize on MDI child form load. As i have two programs that do not maximize the forms

    here is some ideas.. Be sure on the form your loading that the .WindowState property is not set to maximized, in the property section for the form as well as in the formload section.. as well as to where you call the form to be loaded.

  8. #8
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: MDI behavior is strange. please help

    @TheUsed: The problem is, regardless of the settings on the form at design-time, if the user clicks the "maximize" button in the MDI child form's title bar and maximizes it, then opens any new MDI child, that newly opened child will also be maximized. As far as I know, this is the behavior of all standard MDI applications.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  9. #9
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: MDI behavior is strange. please help

    @00Kevin - this is standard, normal, expected behaviour of MDI windows....

    @cyberHawk - true, but then that means the form isn't contained in the MDI Parent, and can be moved outside the confines of the app.... may or may not be what you want.

    @taxes - that's probably the way I'd go with it.... on the form resize event, check the WindowState property and if it's been set to maximize, reset it to "normal" and then (using the .Move method) resize the form so that its width and height match that of the MDI Parent client window area.

    @carlblanchard -as nice as it sounds... there's no such thing as a MaxWidth or a Max Height property... wish it were that easy.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  10. #10
    Fanatic Member
    Join Date
    Sep 2005
    Location
    Toledo, OH
    Posts
    785

    Re: MDI behavior is strange. please help

    oh! okay yeah, I will have to agree with that being the standard.

    Thank you for that clearification

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