Maximize MDI Parent form over entire desktop

VB.Net 2002.

I would like to be able to maximize the main mdi parent form of an application to cover the entire screen including the windows task bar. This is a nice option for the user to have from a context menu and not a must have (although I really want to do it hence the question!!)

I have tried the following from a search (idlemind) (plus similar from George Shepard but I guess it is not working as my form is an mdi form (i have noticed other things dont work with mdi forms today e.g. trying to dispose of a form during load event)

        Dim SR As Rectangle = Screen.PrimaryScreen().GetBounds(New Point(0, 0))
        Me.Location = New Point(0, 0)
        Me.Size = New Size(SR.Width, SR.Height)

I don't know if this can be done without reams of code so if it isn't going to be concise I will accept an answer to that effect and forget about it. For that reason i am just giving 250 points as I have a feeling the answer will be can't be done without a couple of pages of code to analyse.

PS. I have also tried setting border to none, topmost window etc....

I seem to remember all the above did work before my project became MDI and I was messing about with border styles!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics TeacherCommented:
(using VB.Net 2005 Express)

It works for me when the TopMost property is set to True and the BorderStyle is the normal Sizeable.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JeffvClaytonAuthor Commented:
Thanks for the comment, just to prove what I said i opened up an old project (IsMdiContainer = False) and entered the above code and sure enough whole screen gets covered. I then changed IsMdiContainer=True and hey presto it also worked which was a bit of a surprise.

I have now figured out why my new project doesn't work... The WindowState was set to Maximized (seemed reasonable). By setting WindowState to normal and then using my context menu to fire the above code, the form covers the entire screen. Clicking on the Maximize Box while in this state returns the window to being above the Windows Taskbar.

Its now 8.22am and a new day which helps. Thanks for the comment to make me try again. (Still waiting for VB.Net 2005 to arrive! Maybe Monday)


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.