Paint Problem at MDIChild at Opening at Startup in Maximized State
Hi guyz,
I have one MDI form and one MDI Child. Both form's property windowsstate=maximized. When MDI form loads, its child forms load at the load event of MDI. But, It not paints that child form properly to maximized area. there is border appears of that child forms without title. Once we minimize that bad painted form and again maximize it. it works fine.. So, why its doing problem at startup in maximized mode?
I've just transfered my winapp from Vs2005 Beta to Vs2005 express
can anyone tell me.. please? is it a BUG of VS2005 Express?
[681 byte] By [
loganX] at [2007-12-17]
I'm not quite sure what you are asking. The default behavior is for the maximized child form to have a title bar without a title; the title is merged into the MDI container's title bar. Are you saying that after minimizing and restoring the title appears on the Child's title bar?
Steve Hoag
Visual Basic Express
No, Steve. I know when we maximize child forms, its header(Titlebar) merges in MDI form. Its working. But, the overall form is not maximizing (its not growing). I can see its border to its actual size of design time. Its not maximizing properly at first time. Once I minimize it and again maximize it, then it works fine. What should be the problem there? is it some kind of a BUG?
Thank You,
It sounds like it could be a bug, although I can't reproduce it on my machine. Does this happen consistently, or just in one application? If you create a new MDI app, can you reproduce it?
- Steve Hoag
Okay Steve, Its working fine in New MDI application. Just not working in my application which I've converted it from .NET 2.0 BETA. Is there any solution or anything to solve this thing?
It sounds like there may have been a bug with form initialization in Beta 2. You could try creating a new child form and copying your controls and code over to it.
- Steve
Thanks Steve, Thanks for your support. I actually fixed that problem for this project by manualy setting its properties like windowsstate to maximized at assigning its instance. 
I have the same problem, in my case with Visual Studio 2005 .NET Professional. Even a new MDI app shows the same (wrong) result (MDI child not maximizing at first). The maximize button of the childform has the icon of a maximized form, but the form itself isn't maximized. The childform's icon isn't painted either. Only the default form icon is shown. But when minimizing/restoring and then maximizing again, everything is okay.
At home I work with Windows XP SP 2, at work I have the same problem occuring on a W2K machine.
Hi Stefan,
I can't seem to reproduce this, or maybe I just don't understand exactly what you are saying. Here's what I'm doing, and I'm seeing normal behavior:
- Open a new Windows Application project
- For Form1, set IsMdiContainer to True, set WindowState to Maximized.
- Add a second form.
- For Form2, set the WindowState property to Maximized.
- Add the following code to the Form1_Load event:
Dim x As New Form2
x.MdiParent = Me
x.Show()
When I run, Form1 is maximized and Form2 is maximized inside Form1 with its title merged into Form1's title bar( Form1 - [Form2] )
Is this not the behavior that you are seeing?
Steve Hoag
Visual Basic Express
Hi Steve,
Thanks for your reaction. In your way, it works, yes.
But put a menustrip on the MDIParent and then run your code again. Now the childform isn't maximizing anymore.
Any ideas?
Stefan,
Are you saving your form settings via ApplicationSettings? Are you binding a setting to WindowState? If so, the only work around I have found is to not bind to WindowState. Not a great alternative, but it does allow the form to draw properly, at least in what I have seen in my applications.
FYI, Steve, this is reproducible. You have to have a MenuStrip on the form AND you have to be binding WindowState to ApplicationSettings. (i.e. Under Form Properties: ApplicationSettings --> PropertyBinding --> WindowState).
Just my 1?¢ for the holidays. Hope it helps.
Clint
Clint,
No, I do not bind any property... 
My workaround is... a timer. When the MdiChildActivate event is raised, I check if the ActiveMdiChild isn't Nothing, then I start the timer (interval = 10). On it's Tick event I maximize the childform. Visually it is not very nice (although I make use of the good old LockWindowUpdate), but it does the trick.
Stefan
Hi,
I have the exact same problem. The reproduction of this error isn't hard. Just start with a Windows application. Set the Form1 to MDI container and add a menu strip and let it be the main menu for that form.
Create a Form 2 and set i WindowState to maximized. Load and show Form2 from Form1.OnLoad.
I realy need a solution for this.
Pontus Bergquist
Hi,
I had the same problem as follows:
if i set the windowstate property for Form2 to maximized when run Form2 would not maximize. I coded it in the Form2 load method and it works.
Private
Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadMe.WindowState = FormWindowState.MaximizedEnd SubI have a issue however with this:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=386751&SiteID=1
Any ideas?
Ron
Hi,
I have been having the same problem. Try it with controls such as panels, or grids on the form with the anchor set to bottom and see what happens. Totally weird.
Steve