Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
220
Drag tab out into it's own window?
posted

I don't think there is any support for dragging forms out of the MdiTabbedManager, but I was hoping to implement some mechanism to do that. Does anybody know if this is at all possible?

Alternatively is it possible to add additional tools to the context sensitive menu to take the form out of the Tabbed Manager?

I think all I need to do is to write something like this to get the form out:

form.MdiParent = null;

I'm just looking for a good place to let the user do it.

Regards,

Martin.

Parents
  • 220
    posted

    I'm getting somewhere with this but the method I have come up with seems quite buggy to say the least. Here is the code:

            // ***************************************************************************************************
            private void TabbedMdiManager_InitializeContextMenu(object sender, MdiTabContextMenuEventArgs e)
            {
                MenuItem item = e.ContextMenu.MenuItems.Add("Detach", TabbedMdiManager_DetachClicked);
                item.Tag = e.Tab;
            }

            // ***************************************************************************************************
            private void TabbedMdiManager_DetachClicked(object sender, EventArgs e)
            {
                MenuItem item = sender as MenuItem;
                if (item != null)
                {
                    MdiTab tab = item.Tag as MdiTab;
                    if (tab != null)
                    {
                        Form form = tab.Form;
                        form.MdiParent = null;
                    }
                }
            }

    Two problems with this, first the item in the context menu looks weird (I may be able to fix this by playing the the MenuItem properties):

     

    Secondly when the form is detatched it doesn't have a ribbon and it has two borders around it:

    I have a feeling I'm not doing it the way I'm supposed to. Or was it even designed to support the ability to switch between a tab and an a form on its own?

    Any ideas?

    Regards,

    Martin.

Reply Children