问题描述
我的项目是实现一个浏览器。我有一个winform,其中动态添加了tabpages。加载网站后,网页标题将显示在所选标签页的标题上。 tabheader的大小受代码限制。但是当添加冗长的标题时,它超过了tabheader的大小。请帮助我通过显示文本的起始部分填写标题限制内的文本。
例如:而不是W3schools在线教程我想将它显示为W3schools Onli ...
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...
推荐答案
//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!!
这篇关于限制标签页标题上显示的文本长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!