473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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 4468
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******@discussions.microsoft.com> wrote in message
news:52**********************************@microsof t.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******@discussions.microsoft.com> wrote in message
news:52**********************************@microsof t.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
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...
5
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...
4
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...
4
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...
2
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,...
2
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...
2
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...
2
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...
42
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.