)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to enable wordwrap in WinForms TabControlAdv?

Platform: WinForms |
Control: TabControlAdv |
Published Date: November 27, 2014 |
Last Revised Date: February 3, 2020

Wordwrap

In TabControlAdv, you can word wrap the TabPageAdv text by handling its DrawItem event.

C#

void tabControlAdv1_DrawItem(object sender, Syncfusion.Windows.Forms.Tools.DrawTabEventArgs drawItemInfo)
 {
    if(drawItemInfo.Graphics.MeasureString(tabText, drawItemInfo.Font).Width > WrapLength)
    {
       enableMultiLine = true;
       ArrayList list = new ArrayList();
       string[] arr = tabText.Split();
       tabText = string.Empty;
       foreach (string item in arr)
       {
          if (tabText == string.Empty)
            tabText = item + Environment.NewLine;
          else
            tabText = tabText + item;
       }
    }
    if(enableMultiLine)
    {
       tabRect = new RectangleF((float)drawItemInfo.Bounds.X, (float)drawItemInfo.Bounds.Y - 51,                                        (float)drawItemInfo.Bounds.Width, (float)drawItemInfo.Bounds.Height + 100);
    }
 }

VB

Private Sub tabControlAdv1_DrawItem(sender As Object, drawItemInfo As Syncfusion.Windows.Forms.Tools.DrawTabEventArgs)
    If drawItemInfo.Graphics.MeasureString(tabText, drawItemInfo.Font).Width > WrapLength Then
       enableMultiLine = True
       Dim list As New ArrayList()
       Dim arr As String() = tabText.Split()
       tabText = String.Empty
       For Each item As String In arr
          If tabText = String.Empty Then
             tabText = item + Environment.NewLine
          Else
             tabText = tabText & item
          End If
       Next
    End If
    If enableMultiLine Then
       tabRect = New RectangleF(CSng(drawItemInfo.Bounds.X), CSng(drawItemInfo.Bounds.Y) - 51,   CSng(drawItemInfo.Bounds.Width), CSng(drawItemInfo.Bounds.Height) + 100)
    End If
End Sub

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/TabControlAdv_MultiLine597364458.zip

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
Live Chat Icon