Badly behaving child in MDI application

G

Garry

While trying to write good 'best practices' vb.net code to 'show'
consecutive MDI child forms, suddenly the forms were cascaded.

This is not what I want.

Does anyone know how to 'turn this off'?????

Also, when I resize the child form to fit the Client of the parent MDI, to
get the correct values, I use the following code.

Shared Sub FitChildToMDI(ByVal frmMDI As Form, ByVal frmChild As Form)
frmChild.Top = 0
frmChild.Left = 0
frmChild.Height = frmMDI.ClientRectangle.Size.Height - 4
frmChild.Width = frmMDI.ClientRectangle.Size.Width - 4
End Sub

If I subtract less than 4, I get scroll bars which I definately do not want.

Why do I need the minus 4???? Iz there some property of the client rectangle
which has a value 4 at the screen resolution that I am using BUT may have a
different value for a different screen resolution.

Microsoft HELP was very very very very helpful on this point and I got 100
results to my query 'ClientRectangle'. None of them even intimated an answer
to these questions. There was loads and loads and loads and loads of info on
stuff that had no relavence to my problems.

Is it me or is it Microsoft?????

Garry
 
B

Brian Tkatch

Garry said:
While trying to write good 'best practices' vb.net code to 'show'
consecutive MDI child forms, suddenly the forms were cascaded.

This is not what I want.

Does anyone know how to 'turn this off'?????

Also, when I resize the child form to fit the Client of the parent MDI, to
get the correct values, I use the following code.

Shared Sub FitChildToMDI(ByVal frmMDI As Form, ByVal frmChild As Form)
frmChild.Top = 0
frmChild.Left = 0
frmChild.Height = frmMDI.ClientRectangle.Size.Height - 4
frmChild.Width = frmMDI.ClientRectangle.Size.Width - 4
End Sub

If I subtract less than 4, I get scroll bars which I definately do not want.

Why do I need the minus 4???? Iz there some property of the client rectangle
which has a value 4 at the screen resolution that I am using BUT may have a
different value for a different screen resolution.

Microsoft HELP was very very very very helpful on this point and I got 100
results to my query 'ClientRectangle'. None of them even intimated an answer
to these questions. There was loads and loads and loads and loads of info on
stuff that had no relavence to my problems.

Is it me or is it Microsoft?????

Garry

It's you. Microsoft gives you so much information, at times it seems
like its hard to wade through. Out of all the things i complain about
in the Microsoft world, documentation is rarely one of them.

The four is the border of the MDI client. To get the client area size
of the MDI form, you need to check the MDIClient's size, not the MDI
itself.

I posted about that here: <URL:
http://groups.google.com/group/microsoft.public.dotnet.framework/browse_frm/thread/4e9d658a72c36f64>.

HTH,
B.
 

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