MDI Child Forms -- Diffrent Behavior in new Framework

J

Justin Lazanowski

I have an exsiting MDI application. I have the when the child is called from
the Parent, I set it's DockStyle to fill, I also have the child form set to
maximized

In VS 2003 and 1.1 this works the way I want it to, the child form is
maximized whithin the parent so that a title bar is not displayed nor is a
window border, it looks like it's a panel in the parent form.

In VS 2005 and 2.0 it will not draw this way, no matter what I set the
window size property to, the child still draws as a window within the parent
leaving a thin border where it's docked in the parent.

Any idea what I need to do to make it function like the 1.1 version?

Thanks,
Justin
 
A

Amnon

Justin, I had the same problem.

A solution that I found is pasted below

Dim frmBrowse As New Form1
Dim MDIClient As System.Windows.Forms.Control

MDIClient = ReturnMDIClient(frmMain)
frmBrowse.MdiParent = frmMain
frmBrowse.Left = 0 'MDIClient.Left
frmBrowse.Top = 0 'MDIClient.Top
frmBrowse.Width = MDIClient.ClientRectangle.Width
frmBrowse.Height = MDIClient.ClientRectangle.Height


Public Function ReturnMDIClient(ByVal frm As
System.Windows.Forms.Form) As Windows.Forms.Control

Dim c As Control

ReturnMDIClient = frm.Controls(0)

For Each c In frm.Controls
If TypeOf c Is MdiClient Then
ReturnMDIClient = c
End If
Next c

End Function

In VB6 it was so much easier but there were drawbacks. You had to define a
form as an MDIChild at design time and only one MDI per application. (Not
that I found a need for anymore.)

I would suggest that more code has to be written in vb.net 2005 for this
simple resizing than in old and no longer seriously supported VB6.

Let's hope that this is an exception.

Garry

PS - DockStyle shud be set to Manual for the frmBrowse. (I think)
 

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