PC Review


Reply
Thread Tools Rate Thread

How do I calculate neccessary label size

 
 
Thore Berntsen
Guest
Posts: n/a
 
      19th Feb 2004
Say I have a label on a from, and I put some text in it. How do I calculate
the needed size (width and height) of this label so that the whole text is
shown?

Thore Berntsen


 
Reply With Quote
 
 
 
 
Romain TAILLANDIER
Guest
Posts: n/a
 
      20th Feb 2004
a simple solution to use a font with all the char has the same width like
"courrier new" (don't know the english name of the font)
then a simple calcul on the text.len gives the with.

int OneCharWidth = 8; // 8pixels
myLabel.width = (myLabel.text.len + 1)* (OneCharWidth );

It is not very ellegant, but simple and it works

hopes that's help.




"Thore Berntsen" <(E-Mail Removed)> a écrit dans le message de news:
#(E-Mail Removed)...
> Say I have a label on a from, and I put some text in it. How do I

calculate
> the needed size (width and height) of this label so that the whole text is
> shown?
>
> Thore Berntsen
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic size of label, and depending on size label position of tex noord453 Microsoft Excel Programming 3 12th May 2009 01:54 PM
How to calculate font size for a string to make it fit into a rectangle of a fixed size. carterweb@gmail.com Microsoft C# .NET 7 28th Dec 2006 05:53 PM
Easiest way to re-format label document for a different label size =?Utf-8?B?QWxpY2U=?= Microsoft Word Document Management 2 30th Jun 2005 11:00 PM
How to change mailing label size in existing label document =?Utf-8?B?R3Jhbm55QW5u?= Microsoft Word Document Management 1 2nd Dec 2004 05:12 PM
Using <asp:label font-size=16px...> ist not showing size in FireFox Browser Andreas Klemt Microsoft ASP .NET 6 28th Nov 2004 09:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:15 AM.