473,804 Members | 3,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

text overflow in Label

is there any way I can adjust the behavior of a Label when text overflows
it's boundaries?

I have a specific size Label which can show 2 lines of text, but on some
occassions the text I insert may be longer. On such occassion, you can see
the top of a third line of text just above the bottom border of the Label
(the text is cut off by the boundary of the LAbel)

I would rather have it not display this third line at all (stop printing
text onces a specific boundary is reached) but instead I have a ToolTip on
that Label which will show the entire text within the ToolTip.

So how do modify Label so it stops displaying text after 2 lines have been
used up?
Nov 16 '05 #1
2 4544
You can figure out how many display units there are in two lines of your
label, then dynamically figure out how many units in the text your posting
(as different fonts/sizes will matter), then cut it off at max units. Did
something like this once but don't remember the exact code to use.

--
William Stacey, MVP
http://mvp.support.microsoft.com

"MrNobody" <Mr******@discu ssions.microsof t.com> wrote in message
news:52******** *************** ***********@mic rosoft.com...
is there any way I can adjust the behavior of a Label when text overflows
it's boundaries?

I have a specific size Label which can show 2 lines of text, but on some
occassions the text I insert may be longer. On such occassion, you can see
the top of a third line of text just above the bottom border of the Label
(the text is cut off by the boundary of the LAbel)

I would rather have it not display this third line at all (stop printing
text onces a specific boundary is reached) but instead I have a ToolTip on
that Label which will show the entire text within the ToolTip.

So how do modify Label so it stops displaying text after 2 lines have been
used up?


Nov 16 '05 #2
Hi thanks for your reply!

would you elaborate a bit more on "display units" ?

anything to do with getting rectangles that the text would fit in and
comparing it to rectangle of space available in the label?

"William Stacey [MVP]" wrote:
You can figure out how many display units there are in two lines of your
label, then dynamically figure out how many units in the text your posting
(as different fonts/sizes will matter), then cut it off at max units. Did
something like this once but don't remember the exact code to use.

--
William Stacey, MVP
http://mvp.support.microsoft.com

"MrNobody" <Mr******@discu ssions.microsof t.com> wrote in message
news:52******** *************** ***********@mic rosoft.com...
is there any way I can adjust the behavior of a Label when text overflows
it's boundaries?

I have a specific size Label which can show 2 lines of text, but on some
occassions the text I insert may be longer. On such occassion, you can see
the top of a third line of text just above the bottom border of the Label
(the text is cut off by the boundary of the LAbel)

I would rather have it not display this third line at all (stop printing
text onces a specific boundary is reached) but instead I have a ToolTip on
that Label which will show the entire text within the ToolTip.

So how do modify Label so it stops displaying text after 2 lines have been
used up?


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
23238
by: Marek Mänd | last post by:
<select multiple style="height:200px;"> <option>a <option>b </select> Why does Mozilla draw the vertical scrollbar to the SELECT html element? There is plenty of void room below two OPTIONs in the SELECT box, so there is no need for that. How do i get the overflow:auto like thing working in mozilla based
5
3516
by: Brian Henry | last post by:
I have a messaging application that has a data grid with information like an email list would have (from, subject, time sent, size) but the subject could be very long in theory, and then it would word wrap.. the subject is a variable width column (resizes to fit space) while the others are fixed size... the problem is that i dont want the text to ever word wrap.. but truncate the visible subject to match the current cell width... (kinda...
4
2914
by: Lars Netzel | last post by:
Hi On a developer computer I have built a small Form with a label telling the user to press a "update" button on the same form. When the button is pressed (on a user computer, not developer) a Messagebox will apear and give information. This does not show the texts at all.. it instead shows a msgbox which have the right amount of buttons and the size looks like it's taking care of the textlength of the message but there are no texts...
4
23474
by: jawolter | last post by:
I have text that is too long to nicely fit on a given page, so I want to add ellipses to the end that dynamicaly resize based on the person resizing the page width. If you hover it would show the full text, using a title attribute I believe. It works for a div, but not a span... any ideas? Here's a snippet that I'm working on: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
3675
by: Graeme | last post by:
Hi there Yet another daft question. Can I fill a css defined box with a text character such that the box can be set to say, 85% page width, and the text character fills the bos to that width, does not overflow? Graeme
2
2654
by: Joe Delphi | last post by:
Hi, I want to position label text so that it always appears centered when the user re-sizes the browser window. I tried adding the HTML property text-align="CENTER" to the code, but ASP.NET doesn't seem to recognize this HTML attribute. Can someone tell me how to do this?
2
2110
by: george.leithead | last post by:
Hi all, I have a very strange problem! In following Web page (which is generated from a CMS System), the navigation to the left 'dissapears' when you roll the mouse over the links? It does not do this in all browsers either. I have found it to happen in IE 7 and the latest patched IE 6. I have tried to find out the reason, but keep finding strange behaviour! You will see at the bottom of the HTML, I have a comment. If you follow...
2
7070
by: GloStix | last post by:
For some reason, FF likes to put a black underline on all my buttons. No matter what I do, it has the line I've tried displaying as block and cursor, anything.. Also I've been trying to get it so the entire block is clickable, not just the text. I've sorta got it so it's clickable, just some parts of the button I still can't click on. The website is http://pdhtdev.johnabbott.qc.ca/students/2010/james_mann/portfolio/index.htm The css...
42
7039
by: thomas.mertes | last post by:
Is it possible to use some C or compiler extension to catch integer overflow? The situation is as follows: I use C as target language for compiled Seed7 programs. For integer computions the C type 'long' is used. That way native C speed can be reached. Now I want to experiment with raising a Seed7 exception (which is emulated with setjmp(), longjmp() in C) for integer
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.