MDI Min Max - still there

M

Miro

I created an MDI form and made a child form.

On the child form I set the Min / Maximize buttons to false.

However when the child form displays, the minimize button and the "restore"
button show.
By clicking the restore button, the child moves back to its design size, and
then you can no longer
maximize it cause then it respects teh min/max false.

Has anyone else run into this / solution?

Ive googled and I found some "try" solution that say try to make it a fixed
dialog box with Control = false but taht didnt work for me either.

Im trying to create an mdi child form that will always be maximized and can
never be minimized / whatever by the user.

Miro
 
R

rowe_newsgroups

Could you override WndProc method to trap the minimize / restore down
messages?

Also, how does your app handle multiple child forms if you can't
minimize any of them?

Thanks,

Seth Rowe
 
H

Herfried K. Wagner [MVP]

Miro said:
Im trying to create an mdi child form that will always be maximized and
can never be minimized / whatever by the user.

Maybe it's more appropriate to use a set of user controls instead of the MDI
children. MDI children typically represent documents.
 
M

Miro

I tried to set up / program a simillar setup like Quickbooks uses.
I really like the setup they created.

A toolbar docked on top,
a panel docked on left with a splitter on left.
That leaves the mdi forms opening in the right portion of the form.

And as you open the windows, they are fully maximized, and a "window" item
gets added to an "open window" listbox in the
left. I only allow one instance of the window to be opend. Otherwise i
bring it to front.

All gets goofed up when someone clicks the minimize button.

Miro
 
M

Miro

Currently what I do is on the

Form_SizeChanged i have this code
Me.WindowState = FormWindowState.Maximized

That prevents the window from being minimized or restored, but I would
prefer to see if there is a way to get rid of the buttons all together.

Miro
 
R

rowe_newsgroups

Instead of using windowstate = maximized, could you set the window
state to normal, form border style to none, and then size the child
form to the client area of the mdi form? This would give the impression
of a maximized child, but you would lose the child's title bar.

Hope that made sense,

Seth Rowe
 
M

Miro

Tried that, and gave up. :)

It gets too complicated to manage, and at that point I am coding to make the
window look pretty than actually trying to code the real code needed
instead.

Basically think of a form with a Panel docked left, and a Panel docked Top.
In the Top panel is a toolbar - Docked to Top. The Top panel is there so
the Toolbar gets the panels background color.

Now since the left panel ( a side menu ) has a splitter so the user can
adjust it, the space where the new mdi child form can be displayed is
constantly changed. By just setting a maximized state, I accomplish one
other headache i dont want to run into, and that is if the user has a
different resolution, the mdi form in Maximized state will show nice
scrollbars, no titles.

After some more tests I had to remove the Form_SizeChanged event because if
the user manually changes the Form1 window size, and if they have multiple
mdi forms open within, its just super disgusting what happens. So im back
to allowing the user to minimize it, and maximize it, and hopefuly ill find
a solution later.

I almost need an event that is like "on restore", "on minimize".
I looked but couldnt find one, but I guess I could live with the buttons, as
long as I would somehow be able to put code in there to 'do nothing'.

Thats why i was wonding if anyone else ever tried designing a window
interface like this and ran into this similar problem.
-You almost get the same effect like an Outlook Express, where you have
toolbar on top, left, and your "forms" display in the right mid portion of
the screen.
-Having mdi forms makes it easy to develop new screens instead of using
panels or tab pages or other.

Was a good idea though. Thats what someone else suggested on one of the
google posts.
-Even changing the form to fixed dialog doesnt do the trick. The buttons
will always appear.

Miro
 
B

Brian Tkatch

Miro said:
I created an MDI form and made a child form.

On the child form I set the Min / Maximize buttons to false.

However when the child form displays, the minimize button and the "restore"
button show.
By clicking the restore button, the child moves back to its design size, and
then you can no longer
maximize it cause then it respects teh min/max false.

Has anyone else run into this / solution?

Ive googled and I found some "try" solution that say try to make it a fixed
dialog box with Control = false but taht didnt work for me either.

Im trying to create an mdi child form that will always be maximized and can
never be minimized / whatever by the user.

Miro

These may help.

http://groups.google.com/group/micr...nguages.vb/browse_frm/thread/26aa9dd310503b0a
http://groups.google.com/group/microsoft.public.dotnet.framework/browse_frm/thread/4e9d658a72c36f64

B.
 
R

rowe_newsgroups

I almost need an event that is like "on restore", "on minimize".
I looked but couldnt find one, but I guess I could live with the buttons, as
long as I would somehow be able to put code in there to 'do nothing'.

Here's a post from Herfried a while back that may help:

------------------------------------------------------
Is there a way I can get into a form's close/minimize/maximize events when
those buttons (the 3 small squared button in the upper right corner of a
form) are clicked?

\\\
Private Const WM_SYSCOMMAND As Int32 = &H112

Private Const SC_MAXIMIZE As Int32 = &HF030
Private Const SC_MINIMIZE As Int32 = &HF020
Private Const SC_RESTORE As Int32 = &HF120
Private Const SC_CLOSE As Int32 = &HF060

Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = WM_SYSCOMMAND Then
Select Case m.WParam.ToInt32()
Case SC_MAXIMIZE
Debug.WriteLine("Form gets maximized.")
Case SC_MINIMIZE
Debug.WriteLine("Form gets minimized.")
Case SC_RESTORE
Debug.WriteLine("Form gets restored.")
Case SC_CLOSE
Debug.WriteLine("Form gets closed.")
End Select
End If
MyBase.WndProc(m)
End Sub
///
 
M

Miro

I think this may be what Im looking for.

I tried to put
Me.WindowState = FormWindowState.Maximized

in the minimize / restore events, but it doesnt do anything.
The debug writemessages work,
If I put it in the Maximize section, the parent gets maximized too.

When the child first form gets created it doesnt open in maximize.

I know this has to be close to what im looking for.

Have you used this?

Thanks.

Miro
 
R

rowe_newsgroups

I tried to put
Me.WindowState = FormWindowState.Maximized

in the minimize / restore events, but it doesnt do anything.
The debug writemessages work,
If I put it in the Maximize section, the parent gets maximi

Why not just put "Exit Sub" in the restore and minimize Cases? That
would completely disable the buttons as it stops the message from being
sent.

Thanks,

Seth Rowe
 
M

Miro

Excellent!!!! :) :)

Worked like a charm. The buttons are still up there - I can live with that,
but but visual aspect of the application will stay how it is.
Exit Sub looks like the answer. - I have much to learn still.

Thank you very much for all your help.

Miro
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top