Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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


C#
//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!!
 
Share this answer
 
Comments
Anju Sadanandan 2-Feb-13 5:15am    
thank u
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[^]
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900