Click here to Skip to main content
13,549,847 members
Rate this:
Please Sign up or sign in to vote.
See more:
My project is to implement a browser. I have a winform in which tabpages are added dynamically. After loading a site the title of the webpage is displayed on the title of the selected tabpage. Size of the tabheader is limited by code.But when a lengthy title is added it exceeds the size of the tabheader. Please help me to fill the text within the limit of header by displaying the starting portion of the text.
for eg: instead of W3schools Online Tutorial i want to display it as W3schools Onli...
Posted 1-Feb-13 22:00pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

To have a good position of the ellipsis you need to measure the text, find the position where you could place it. You could use the code of this article more or less as it is, but with little modifications for sure: Auto Ellipsis[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

First choose what max length of string you want in the header before loading the title use something like below:-

//assume max len 10 and 3 dots means you should show only 7 chars and three dots
        string title = "Ravi malviya"; //example only
        title = title.Substring(0, 7);
        title += "...";

Best of luck!!
Anju-Sadanandan 2-Feb-13 5:15am
thank u

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.180515.1 | Last Updated 2 Feb 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100