Nirmal
Nirmal

Reputation:

Placing Image control in MDI form

I have placed an image controls in center the mdi. But when I an opening a child form the form form appears below the image control.

Please help ???

Upvotes: 2

Views: 1767

Answers (3)

Prasant
Prasant

Reputation: 11

A small idea to solve this problem.

Use a picture box to show your image in MDI form and try the code below:

Private Sub MDIFORM_MdiChildActivate(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.MdiChildActivate

    Dim cnt As Integer = 0
    For Each frm As Form In My.Application.OpenForms
        cnt += 1
    Next
    If cnt > 1 Then
        Me.PictureBox1.Hide()
    Else
        Me.PictureBox1.Show()
    End If
End Sub

Upvotes: 1

Ken Keenan
Ken Keenan

Reputation: 10538

This is the way MDI forms work in .NET. According to my copy of Professional VB 2005 (Wrox), "in VB.NET, an MDI parent can contain any control that a regular form can contain. Buttons, labels, and the like can be placed directly on the MDI surface. Such controls will appear in front of any MDI child forms that are displayed in the MDI client area" (emphasis mine)

I imagine what you're trying to do is have some kind of logo appear in the client area in the MDI form? In this case, you will need to draw this in the form's Paint event rather than using an Image control.

Upvotes: 0

Shea
Shea

Reputation: 11243

Once the outer form is an MdiParent, the mdiclient area will expand to fill all space not used by other containers. So you'll either need to put the image somewhere else (e.g., a panel docked to the left, separated by a Splitter from the mdi client area) or not put the image on child forms.

Upvotes: 0

Related Questions