When i add a control on a mdiparent form for example a label control.
The label stands for the mdi child. How is possible to bring mdi child on the foreground? When i try this code
Code:
label.SendToBack();
It doesn't appears anymore.
Anyone did solved this problem?
I'm confused as to what you actually want to accomplish. If you want the user to be able to click something to activate each child form then you should add a MenuStrip and assign one of its menu items to its MdiWindowListItem property. You'd usually use a menu item named "Window". If you do that a menu item will automatically be added for each MDI child window.
OK, I get it now. When you set the IsMdiContainer property of a form to True what actually happens is that an MdiClient control is added to your form. That's what the grey area is that you see covering the form and it's that control that acts as the host for the child forms.
Now, when you add a Label to your parent form it is added over the MdiClient control. That means that it is also over the top of any child forms that that MdiClient control is hosting. It's simply not possible to do what you want in the designer. There is no way to access that MdiClient control in the designer to place controls on it directly. In fact, there's no way to place controls on it in code either because it is designed to host forms only.
If you want text on your MdiClient then you need to use GDI+ to put it there:
vb Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each ctl As Control In Me.Controls
If TypeOf ctl Is MdiClient Then
AddHandler ctl.Paint, AddressOf MdiClient_Paint
Exit For
End If
Next ctl
End Sub
Private Sub MdiClient_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)
'Draw text directly on the MdiClient.
e.Graphics.DrawString("This text can be covered by child windows.", _