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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to show tooltip for the tab header in WinForms TabbedMDIManager?

Platform: WinForms |
Control: TabbedMDIManager |
.NET Framework: 4

Tooltip

We can set tooltip text for header of tab items in the TabbedMDIManager on MouseMouse of TabControl. It can be achieved by SetToolTip method based on the mouse position and tab bounds. The following code demonstrates the same.

C#

//Initialize
Form2 f1 = new Form2();
Form3 f2 = new Form3();
Form4 f3 = new Form4();
 
TabControlAdv tabcontrol;
tabbedMDIManager1.TabControlAdded += TabbedMDIManager1_TabControlAdded;
 
//TabStyle
tabbedMDIManager1.TabStyle = typeof(Syncfusion.Windows.Forms.Tools.TabRendererWorkbookMode);
 
//For MDI Forms
f1.MdiParent = this;
f1.Show();
f2.MdiParent = this;
f2.Show();
f3.MdiParent = this;
f3.Show();
 
private void TabbedMDIManager1_TabControlAdded(object sender, Syncfusion.Windows.Forms.Tools.TabbedMDITabControlEventArgs args)
{
  tabcontrol = args.TabControl;
  tabcontrol.ActiveTabColor = Color.Green;
  tabcontrol.ActiveTabForeColor = Color.White;
  tabcontrol.InactiveTabColor = Color.Brown;
  tabcontrol.InActiveTabForeColor = Color.Yellow;
  tabcontrol.TabPanelBackColor = Color.LightGray;
  tabcontrol.ItemSize = new Size(30, 30);
  if(tabcontrol != null)
  {
    //For Tooltip
    tabcontrol.MouseMove += Tabcontrol_MouseMove;
  }
}
 
private void Tabcontrol_MouseMove(object sender, MouseEventArgs e)
{
  for (int i = 0; i < tabcontrol.TabPages.Count; i++)
  {
    Rectangle r = tabcontrol.GetTabRect(i);
    if (r.Contains(e.Location) && toolTip1.GetToolTip(tabcontrol).ToString() != tabcontrol.TabPages[i].Text)
    {
      //Set ToolTip Text
      toolTip1.SetToolTip(tabcontrol, tabcontrol.TabPages[i].Text);
      break;
    }
  }
}

VB

'Initialize 
Private f1 As New Form2()
Private f2 As New Form3()
Private f3 As New Form4()
 
Private tabcontrol As TabControlAdv
AddHandler tabbedMDIManager1.TabControlAdded, AddressOf TabbedMDIManager1_TabControlAdded
 
'TabStyle
tabbedMDIManager1.TabStyle = GetType(Syncfusion.Windows.Forms.Tools.TabRendererWorkbookMode)
 
'For MDI Forms
f1.MdiParent = Me
f1.Show()
f2.MdiParent = Me
f2.Show()
f3.MdiParent = Me
f3.Show()
 
Private Sub TabbedMDIManager1_TabControlAdded(ByVal sender As Object, ByVal args As Syncfusion.Windows.Forms.Tools.TabbedMDITabControlEventArgs)
  tabcontrol = args.TabControl
  tabcontrol.ActiveTabColor = Color.Green
  tabcontrol.ActiveTabForeColor = Color.White
  tabcontrol.InactiveTabColor = Color.Brown
  tabcontrol.InActiveTabForeColor = Color.Yellow
  tabcontrol.TabPanelBackColor = Color.LightGray
  tabcontrol.ItemSize = New Size(30, 30)
  If tabcontrol IsNot Nothing Then
    'For Tooltip
    AddHandler tabcontrol.MouseMove, AddressOf Tabcontrol_MouseMove
  End If
End Sub
 
Private Sub Tabcontrol_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs)
  For i As Integer = 0 To tabcontrol.TabPages.Count - 1
    Dim r As Rectangle = tabcontrol.GetTabRect(i)
    If r.Contains(e.Location) AndAlso toolTip1.GetToolTip(tabcontrol).ToString() <> 
tabcontrol.TabPages(i).Text Then
      'Set ToolTip Text
      toolTip1.SetToolTip(tabcontrol, tabcontrol.TabPages(i).Text)
      Exit For
    End If
  Next i
End Sub

 

Screenshot

Show tooltip hover on the tab header in TabbedMDIManager

 

Samples:

C#:  TabbedMDIManagerSample

VB: TabbedMDIManagerSample

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile