We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

TabbedMdi "Create New Horizontal Group" for each open tab

What is the best way to programmatically go through all open tabs and create a new horizontal group?

I tried the code below:
foreach(Form form in this.tabbedMDIManager.MdiChildren)
{
form.Activate(); if(this.tabbedMDIManager.CanCreateNewHorizontalGroup())
{ this.tabbedMDIManager.CreateNewHorizontalGroup();
}
}

It works but it has a horrible repainting issue where as if I go to each tab and use the right click menu "Create New Horizontal Tab Group" everything is fine. So is their anyway to access the right click context menu of a tab programtically?

Thanks

I am using v5.1 trial of essential tools

1 Reply

RF Rashidha F Syncfusion Team July 16, 2007 02:46 PM UTC

Hi Alan,

My apologies for the delay in responding to you.

If your intention is to create a HorizontalGroup without using ContextMenu means, please use the following code snippet in button_click Event.

Form childform = new Form();
childform.WindowState = FormWindowState.Normal;
childform.Text = "MDI Child Form " + count.ToString();
childform.MdiParent = this;
childform.Show();
this.tabbedMdiManager.CreateNewHorizontalGroup();

Using Beforpopup Event and clear method you can disable and clear the contextmenu respectively.

void ContextMenuItem_BeforePopup(object sender, CancelEventArgs e)
{
e.Cancel = true;
}
this.tabbedMdiManager.ContextMenuItem.Items.Clear();

You can add the new item in context menu using Add() Method in tabbedMDIManager. The following code snippet which illustrate how to add a neww context menu item in tab.

BarItem x = new BarItem();
x.Text = "New";
this.tabbedMdiManager.ContextMenuItem.Items.Add(x);
x.PerformClick();
x.Click += new EventHandler(x_Click);

Pleasse refer the attached sample.

http://websamples.syncfusion.com/samples/Tools.Windows/F63672/main.htm

The above sample which illustrates how to create horizontalgroupbar and how to customize the tab using contextmenu programatically.

Thanks and Regards,
Rashidha.

Loader.
Live Chat Icon For mobile
Up arrow icon