Windows Develop Bookmark and Share   
 index > Windows Forms General > windows forms maximize issue
 

windows forms maximize issue

Hi,

I have created my application in vb.net.

In my application, there are three forms placed on a panel. These 3 forms(f1, f2, f3)individually can be maximized or minimized. On main form i have two buttons say b1 and b2. Clicking these buttons above 3 forms are displayed respective to that for. Means say 3 forms for button 1 are displayed. when i click button2, 3 forms for button1 gets hidden and 3 forms are displayed for button 2.

Now the problem is, I set windowstate for f1 of button1 as maximized. then i clickbutton2. and again come back by clicking button1. as soon as i click button1, all 3 forms f2, f3 are displayed as maximized & then finally f1 is maximized. That is i get flickering like this in visualization of maximized form.

Can anybody suggest me some solution for this?

Thanks,

Kalpana.

KalpanaB  Monday, July 16, 2007 1:40 PM
Just don't forcibly maximize your new active MDI child. If you routinely do this, MDI is not the right solution. Just make your child forms borderless and set their TopLevel property to false so they turn into child controls.
nobugz  Wednesday, July 18, 2007 9:47 AM
Multiple forms on a panel? And you maximize them? Neat trick but nothing I've ever seen before. Do you actually mean MDI?
nobugz  Monday, July 16, 2007 7:06 PM
i think you should tell your issues more clearly.
atarikg  Monday, July 16, 2007 8:15 PM

ok. I will place a simple scenario of my problem to u.

there are two buttons who do different tasks lets say task1 and task2. On pressing each button i am displaying 3 child forms(MDI) with Normal windowstate.

Now, the steps are-

1. press task1.

2. three forms are displayed in normal windowstate(form1, form2, form3).

3. Now i maximize form1.

4. Now here this form is maximized upto the size of user control on which they are placed.

5. Click task2. three forms with Normal windowstate are displayed.

6. i again press back task1.

7. now instaed of form 1 displayed as maximize, form2(or form3)is maximized.

at step 5, when task2 is clicked, 3 forms for task1 are hidden using form.hide() method. similarly for task2 also. this is like when i click any buttton previous forms should be hidden.

i have stored windowstate of each form in the property of form whnever i maximize or minimize the form. this is readOnly property.So on after form.show(), i loop each form and applythis stored windowstate back to forms windowstate.

This scenarion is rare to reproduce in prototype. coz that could not be exact my application.

this is only i can demonstarte about my aplli.

thanks.

KalpanaB  Tuesday, July 17, 2007 5:30 AM
That didn't help much. But at least we know you're talking about an MDI app. Windows enforces only one MDI child can be in the maximized state and that one child has the be the active child. When you activate another child, Windows forces the previously maximized child back to normal state. That isn't a pretty sight, there are lots of repaints. Best thing to do is to always restore a child before making any activation changes:

private void restoreChild() {
if (this.ActiveMdiChild != null && this.ActiveMdiChild.WindowState == FormWindowState.Maximized)
this.ActiveMdiChild.WindowState = FormWindowState.Normal;
}

nobugz  Tuesday, July 17, 2007 10:32 AM

Ya...thanks ...

i would like to mention here...that from this solution my actual problem starts.

This solution is already implemented in my application before one year.

what we hav done is we have restored maximized window to normal state before hidding the form and applied it original maximized state after form.show().

(It is our applications requirement). Now this same flow of code executes in different scenarios also. In this scenario it is neccessary to hide all forms first and depending upon new arrangments forms are arranged and showed.

Due to this i get a flickering effect to my maximized form( max. form restores at Normal state and again restored to maximize state). I have done suspend layout and resume layout but it also didnot worked.

Also i cant avoid this flow in my application.

How can i avoid this flickering effect?

is there any other solution to original problem?

Thanks,

Kalpana.

KalpanaB  Wednesday, July 18, 2007 9:18 AM
Just don't forcibly maximize your new active MDI child. If you routinely do this, MDI is not the right solution. Just make your child forms borderless and set their TopLevel property to false so they turn into child controls.
nobugz  Wednesday, July 18, 2007 9:47 AM

You can use google to search for other answers

Custom Search

More Threads

• BackGroundImage & Performance
• Me.Close behaves differently in vb.net 8.0
• using the container (member's of form1)of form1 in form2
• Adding image to ListView item
• App crash on Vista from WebBrowser only, works in IE
• Tool bar buttons
• Getting the word when a mouse hovers and displaying tooltip only if its a link
• MSN 7.0 Look and feel
• Usercontrols in winforms
• xpCommonControls..