|
-
Jan 24th, 2007, 03:14 PM
#1
Thread Starter
Fanatic Member
[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
-
Jan 24th, 2007, 03:37 PM
#2
Re: [2005] Minimize application's open forms
 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:
For Each F As Form In Application.OpenForms
F.WindowState = FormWindowState.Minimized
Next
and it worked just as expected. When you run that it actually closes the forms?
-
Jan 24th, 2007, 03:41 PM
#3
Thread Starter
Fanatic Member
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
-
Jan 24th, 2007, 03:49 PM
#4
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.
-
Jan 24th, 2007, 03:52 PM
#5
Thread Starter
Fanatic Member
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
-
Jan 24th, 2007, 03:56 PM
#6
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
-
Jan 24th, 2007, 04:04 PM
#7
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|