473,396 Members | 1,760 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,396 software developers and data experts.

Calculating how big text is.

UJ
I have a small window that contains some text. I want to make the window as
small as possible but still be able to hold all of the text ( the text
changes over time ).

Is there any way I can figure out how wide/tall text label would need to be
to handle the text?

TIA - Jeff.
Apr 11 '06 #1
2 1203
UJ,

Isn't it possible to show the text via Lable with AutoSize set to *true*
when you change the text the size of the Label will change and you can read
the Size prop of the label.

Otherwise there is Graphics.MeasureString method as well as
TextRenderer.MeasureText method (.NET 2.0 only), which more precise than the
Graphics counterpart.
--
HTH
Stoitcho Goutsev (100)

"UJ" <fr**@nowhere.com> wrote in message
news:et**************@TK2MSFTNGP04.phx.gbl...
I have a small window that contains some text. I want to make the window as
small as possible but still be able to hold all of the text ( the text
changes over time ).

Is there any way I can figure out how wide/tall text label would need to
be to handle the text?

TIA - Jeff.

Apr 11 '06 #2
UJ
Thanks! That worked great.

J.

"Stoitcho Goutsev (100)" <10*@100.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
UJ,

Isn't it possible to show the text via Lable with AutoSize set to *true*
when you change the text the size of the Label will change and you can
read the Size prop of the label.

Otherwise there is Graphics.MeasureString method as well as
TextRenderer.MeasureText method (.NET 2.0 only), which more precise than
the Graphics counterpart.
--
HTH
Stoitcho Goutsev (100)

"UJ" <fr**@nowhere.com> wrote in message
news:et**************@TK2MSFTNGP04.phx.gbl...
I have a small window that contains some text. I want to make the window
as small as possible but still be able to hold all of the text ( the text
changes over time ).

Is there any way I can figure out how wide/tall text label would need to
be to handle the text?

TIA - Jeff.


Apr 12 '06 #3

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

Similar topics

5
by: Ron Adam | last post by:
Hi, I'm having fun learning Python and want to say thanks to everyone here for a great programming language. Below is my first Python program (not my first program) and I'd apreciate any...
25
by: kie | last post by:
hello, i have a table that creates and deletes rows dynamically using createElement, appendChild, removeChild. when i have added the required amount of rows and input my data, i would like to...
2
by: kuhni | last post by:
Hi everybody! After searching newsgroups for a couple of hours, I now try asking directly (running the risk of asking again the same question). My problem is to predict when the size of the...
0
by: robin9876 | last post by:
In an Access 2000 database on some forms 'Calculating...' is continuously displayed in the status bar window and the text of the control is automatically selected. The only workaround is switching...
2
by: Tim Marshall | last post by:
Wondering if anyone has any suggestions for this. Sometimes in the form reports my users run, a data sheet subform on a main form, with totals in text boxes with calculated controlsources...
1
by: MsBarnes | last post by:
I'm a newbie to the programming field and I really need help to understand what i'm doing wrong. This is the exercise i'm working on I need to create an application that allows the users to enter...
10
by: asmasm1 | last post by:
i am calculating irr and pass listarray created at runtime to irr function and i get error. as i'm new to .net i have to calculate irr textbox2.text specify the no installments textbox1.text...
2
by: hgarg | last post by:
The onpaint() is getting called before calculating the required parameters by listBox1_SelectedIndexChanged function. I tried calling it at the end of this function. But of no use. Due to this issue...
6
by: jonnyboy | last post by:
Hello, I have an Access application with a number of forms. On opening one particular form, the application will sometimes appear to get stuck in a loop with 'Calculating...' in the status bar for...
4
by: sumit kale | last post by:
Hi, Can somebody help me resolve my problem ? I am getting error when calculating total using unbound textfiled in subform. I have a main form called purchase_register_master and a subform...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.