|
-
Feb 4th, 2006, 08:49 PM
#1
Thread Starter
Frenzied Member
setting windowstate
Hey,
I have a form that opens up another form. In the newly opened form I have the following code running to maximize it:
Me.WindowState = FormWindowState.Maximized
When I close the newly opened form, the previous form that opened the one being closed is maximized as well. Why is that happening?
Don't anthropomorphize computers -- they hate it
-
Feb 4th, 2006, 09:18 PM
#2
Re: setting windowstate
Do you have some kind of maximize code anywhere inside of the one that originally called it?
-
Feb 4th, 2006, 09:19 PM
#3
Thread Starter
Frenzied Member
Re: setting windowstate
no, only the form that is opening up has that code.
It's a form showing a report so I want it maximized by default.
That is the only place in the app that has maximizing code in it.
Don't anthropomorphize computers -- they hate it
-
Feb 4th, 2006, 09:23 PM
#4
Re: setting windowstate
What event is that code inside? It's definately not inside the first form, even during the showing of the second? Me. anything refers to the current object.
Bill
-
Feb 4th, 2006, 09:24 PM
#5
Thread Starter
Frenzied Member
Re: setting windowstate
The code is inside the form that is opening up. Yes, it does uses the me object to maximize itself.
Don't anthropomorphize computers -- they hate it
-
Feb 4th, 2006, 09:24 PM
#6
Re: setting windowstate
I'd suggest that you create an empty Resize event handler for the first form and put a breakpoint on the declaration. That way you can look at the call stack when the resizing happens and see where it came from.
-
Feb 4th, 2006, 09:48 PM
#7
Thread Starter
Frenzied Member
Re: setting windowstate
In the report form (the one that was maximized), the following line causes the calling form to maximize as well
MyBase.Dispose(disposing)
it happens in teh Dispose sub.
This is weird.
Don't anthropomorphize computers -- they hate it
-
Feb 4th, 2006, 09:52 PM
#8
Re: setting windowstate
Have you derived this "report form" from another form of your own creation, or does it inherit Form directly?
-
Feb 4th, 2006, 10:04 PM
#9
Thread Starter
Frenzied Member
Re: setting windowstate
Inherits System.Windows.Forms.Form
Don't anthropomorphize computers -- they hate it
-
Feb 4th, 2006, 10:07 PM
#10
Re: setting windowstate
When your breakpoint gets hit can you double-click on the entries in the call stack to look at that code, or is it not accessible?
-
Feb 4th, 2006, 10:08 PM
#11
Re: setting windowstate
You haven't at any point set the second form as the Owner of the first have you?
-
Feb 5th, 2006, 02:10 AM
#12
Thread Starter
Frenzied Member
Re: setting windowstate
no, the mdi parent form is the parent of the new form, as it is the parent for all the other forms.
Don't anthropomorphize computers -- they hate it
-
Feb 5th, 2006, 03:12 AM
#13
Frenzied Member
Re: setting windowstate
i think this is the standard behaviour for mdi Forms.
all mdi childs tends to have the same window state, i dont like it either but that is the way it is
rgds
-
Feb 5th, 2006, 03:23 AM
#14
Re: setting windowstate
OK, nowhere previously did you mention that any of this involved MDI forms. I assumed that it was just one top-level form opening another top-level form. Now that we know that it's MDI, do you mean that the parent is maximised when the child is or that another child is maximised? If it's the latter then, as maged says, that is normal behaviour. It is not possible to chnage that without using extremely hacky means, and even then I'm not sure that there aren't issues.
-
Feb 5th, 2006, 03:41 AM
#15
Thread Starter
Frenzied Member
Re: setting windowstate
no, the parent is maximized at all times. The form that is calling the report form gets maximized after I exit the report form. The report form maximizes itself upon the Form_Load event.
Don't anthropomorphize computers -- they hate it
-
Feb 5th, 2006, 04:32 AM
#16
Re: setting windowstate
If one MDI child is maximised then they all are. That's standard behaviour. Try switching to the first child window before closing the second and you'll see that it is already maximised at that point. perhaps it doesn't technically happen until the first time you view it but as soon as you maximise one child then they will all be maximised the next time you look them. The way to workaround this may be to set the WindowState of the second window back to Normal before closing it.
-
Feb 5th, 2006, 03:53 PM
#17
Thread Starter
Frenzied Member
Re: setting windowstate
Yeah, I though about doing that. My app is becoming quite large and I don't want to be going through all the forms that might possibly be calling the report form and trapping their resize event. Damn...
Don't anthropomorphize computers -- they hate it
-
Feb 5th, 2006, 03:59 PM
#18
Re: setting windowstate
How about just calling this in the form.closing event of your report form:
VB Code:
Me.WindowState = FormWindowState.Normal
Bill
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
|