preventing mdi child forms from displaying menustrip when not active - vb.net

I have an MDI container which has a menustrip of its own. I have three child forms which (can) be displayed in the MDI container. All three of these forms have their own menus. The child form which is active has its menu displayed along the menu items from the MDI form but the other two forms (those forms which aren't active) will then display their own menu items. How can I prevent this?
When a child form is not active, I just want the menustrip of that form to be empty. Once I make the form active, it can display its menu items in the MDI form menustrip.

Related

vb.net mdi child is hidden behind MDI Parent Panels

I am planning to have a vb.net windows form applocation that has a main mdi ( contains menu strip + panels all over the mdi )
the problems is when a child form is shown , and when minimizing the child form it disappears behind the main mdi.
any ideas how to solve this without changing the size of the child form
MDI Issue

How to use PictureBox with MDI form?

I have an MDI windows form and many child windows forms in vb.net. What exactly done that the Mdi form have a PictureBox control over it. If I call a child form from mdi form then PictureBox of MDI form overlap the child form mean it hides the child form behind the PictureBox of MDI windows form.
How to send PictureBox behind windows forms?
This is how i approached the situation.
Since i am using a MDI-Parent Form and other Child Forms, I thought to Show() the picture box (pbImage.Show()) when the MDI Parent Control is doing nothing. If we open a new Child form, then we Hide() the pictureBox. Worked for me.
There are some facts about MDI Container Form that you should know:
The client area of the form is filled by MdiClient control which hosts all MDI children. So if you add a Control to the MDI parent, it will be located in front of the MdiClient and so it will be shown in front of MDI child forms.
You can not add any control to MdiClient control. It just allow adding MDI child forms.
To show a picture in MDI parent, you can set BackgroundImage and BackgrroundImageLayout, for example:
Dim mdiClient = Me.Controls.OfType(Of MdiClient)().First()
AddHandler mdiClient.Resize, Sub(s, a) mdiClient.Invalidate()
Me.BackgroundImage = My.Resources.SomeImage
Me.BackgroundImageLayout = ImageLayout.Center

Transfer MainMenu Items to MenuStrip?

I work on MDI winform app in VB. One form which become child of my MDI have a mainMenu control with a lot of items. I want to show this mainMenu control on specific panel of MDI, or to add all of it's items on MenuStrip control which is on MDI?

VB.NET MDI Children Focus only on Title Bar Click

One would imagine that clicking anywhere within the MDI Child form (or on any control) will focus that form. But in my application I can only focus a MDI child by clicking on its titlebar, which is an abnormal behavior on the part of the user. My forms are filled with either controls or panels so I don't have the luxury of just "clicking on the form." But clicking anywhere within it should focus it.
I haven't been able to find a solution to this problem although it seems others are having it as well.
I figured it out. If you are setting the child form mdiParent property after you are calling Form.Show then it messes up the focus of all the child forms.
When I set mdiParent property of the form first and then call .Show(), everything works perfectly as expected.

Why is MDI parent occasionally not minimizing?

I have a MDI parent that opens another form like this:
Dim frm As New Form1
frm.ShowDialog(Me)
That form has a button that, when clicked, does this:
CreateObject("Shell.Application").ToggleDesktop()
The button operates as expected (showing the desktop) most of the time but occasionally does not minimize the MDI parent. All the other windows, including the form above get minimized every time.
Why is this happening, and how do I fix it?
Instead of trying to allow a form shown with ShowDialog I changed the angle from which I'm approaching. I'll show the form with Show and assign the MdiParent and just fake the modality of the form instead. The fake modal will disable all other parts of the MDI parent except the system buttons in the title bar. If the user attempts to close the MDI parent, the "modal" window will beep once and blink the title bar a bit.