By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,990 Members | 2,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,990 IT Pros & Developers. It's quick & easy.

Badly behaving child in MDI application

P: n/a
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
Nov 7 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Garry wrote:
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.

Nov 8 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.