Results 1 to 7 of 7

Thread: [2005] Minimize application's open forms

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2003
    Posts
    758

    [2005] Minimize application's open forms

    I have a main menu form that launches another form, which can be another menu which then launches another form, an so on. At some times, there are 4 or more forms visible on the desktop. I would like to be able to minimize the form that has focus and have it minimize all of the other forms.

    I have a frmParent that all of my other forms inherit from, either directly or through another parent form that inherits this form. I was hoping to add some code to frmParent in the Resize event handler that would minimize all of the forms.


    Thoughts on how to best do this?

    PS - I tried to iterate through Application.OpenForms and set WindowState to Minimized, but it actually closes the forms.
    Last edited by Aspnot; Jan 24th, 2007 at 03:23 PM.
    My.Settings.Signature = String.Empty

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Minimize application's open forms

    Quote Originally Posted by Aspnot
    I have a main menu form that launches another form, which can be another menu which then launches another form, an so on. At some times, there are 4 or more forms visible on the desktop. I would like to be able to minimize the form that has focus and have it minimize all of the other forms.

    I have a frmParent that all of my other forms inherit from, either directly or through another parent form that inherits this form. I was hoping to add some code to frmParent in the Resize event handler that would minimize all of the forms.


    Thoughts on how to best do this?

    PS - I tried to iterate through Application.OpenForms and set WindowState to Minimized, but it actually closes the forms.
    I tested
    VB Code:
    1. For Each F As Form In Application.OpenForms
    2.             F.WindowState = FormWindowState.Minimized
    3.         Next
    and it worked just as expected. When you run that it actually closes the forms?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    May 2003
    Posts
    758

    Re: [2005] Minimize application's open forms

    It sure does. I couldn't figure out what was happening, so I added a FormClosing handler to one of my sub-menus and it is actually getting called.

    I am wondering if it has something to do with the fact that the main form is set to ShowInTaskbar, but the sub form is set not to. When the sub form minimizes, it actually minimizes to the desktop and then the main form minimizes to the taskbar and then the sub form goes away.
    My.Settings.Signature = String.Empty

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Minimize application's open forms

    it may have something to do with how they are being shown? like

    ShowDialog versus Show and possibly also the border styles of the forms?

    I did the test showing 3 forms each one opened by the next using the .Show method (so no parent is being set) and they were all set to sizable for the border.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    May 2003
    Posts
    758

    Re: [2005] Minimize application's open forms

    Mine are all ShowDialog and the BorderStyle is typically either FixedDialog or FixedSingle.

    Any other ideas for a way to minimize the forms?

    They are currently using either the Show Desktop icon or WindowsKey-M. This works for them, but I thought it should be fairly easy to make this happen. Maybe not...
    My.Settings.Signature = String.Empty

  6. #6
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Minimize application's open forms

    the form must be losing its modal status hence closing it.

    Its funny you should mention the show desktop shortcut, because I actually JUST posted some .NET code on how to do that in VB today.

    http://www.vbforums.com/showthread.php?t=449085

    It works with option strict on

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    May 2003
    Posts
    758

    Re: [2005] Minimize application's open forms

    Hmm. I may link that in to the Resize event handler. Although, that would be misleading to a typical Windows user.
    My.Settings.Signature = String.Empty

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