The child form also still appears to be in memory.
In the root path for the ContextMenuStrip I see that is is referenced by PropertyStore.ObjectEntry[]. After some searching I found that I needed to add the following code:
Code: Select all
protected override void OnMdiChildActivate(EventArgs e)
{
base.OnMdiChildActivate(e);
try
{
typeof(Form).InvokeMember("FormerlyActiveMdiChild",
BindingFlags.Instance | BindingFlags.SetProperty |
BindingFlags.NonPublic, null,
this, new object[] { null });
}
catch (Exception)
{
// Something went wrong. Maybe we don't have enough permissions
// to perform this or the "FormerlyActiveMdiChild" property
// no longer exists.
}
}
It looks like the child form is no longer in memory.
Do I need to do some type of cleanup (maybe in the form.closing event) to fix the ToolStripScrollButton issue?