0

I'm using DotNetBar component SuperTabControl, and I want to display the context menu if the user right click a tab, I found the following code but the problem is my SuperTabControl doesn't have the GetTabRect function.

if (e.Button == MouseButtons.Right)
            {
                for (int i = 0; i < this.superTabControl1.Tabs.Count; ++i)
                {
                    Rectangle r = this.superTabControl1.GetTabRect(i);
                    if (r.Contains(e.Location))
                    {
                       //display menu 
                    }
                }
            } 
Badro Niaimi
  • 959
  • 1
  • 14
  • 28

1 Answers1

0

As long as there is no answer for my question, I used this code in order to manage closing tabs basing on selected option on my context menu. To close all the tabs except the seelcted one I used this code.

for (int i = this.superTabControl1.Tabs.Count - 1; i >= 0; i--)
            {
                BaseItem item = this.superTabControl1.Tabs[i];
                if (!item.Equals(this.superTabControl1.SelectedTab))
                {
                    (item as SuperTabItem).Close();
                }
            }

To close all the tabs.

 for (int i = this.superTabControl1.Tabs.Count - 1; i > 0; i--)
            {
                BaseItem item = this.superTabControl1.Tabs[i];
                (item as SuperTabItem).Close();
            }

To close the selected Tab I used this code:

this.superTabControl1.SelectedTab.Close();
Badro Niaimi
  • 959
  • 1
  • 14
  • 28