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

Function to measure text length

I'm trying to create a function that will return the length of a text
string in inches.

e.Graphics.MeasureString(mString, mFont)

Seems to be what I'm looking for, but I don't know how to pass
PaintEventArgs (e).

I don't want to use it in a paint event, I just want it to return a
number when I pass it a string and a font. How do I do this?
Nov 11 '06 #1
2 1409
Never mind. I figured it out.

On Sat, 11 Nov 2006 02:09:51 GMT, Kevin <Ke****@nospam.cfl.rr.com>
wrote:
>I'm trying to create a function that will return the length of a text
string in inches.

e.Graphics.MeasureString(mString, mFont)

Seems to be what I'm looking for, but I don't know how to pass
PaintEventArgs (e).

I don't want to use it in a paint event, I just want it to return a
number when I pass it a string and a font. How do I do this?
Nov 11 '06 #2
Kevin,

Will you as you have figured it out show what you did, people are searching
in this newsgroup, there is quite a few about what you have asked, but now
you are blocking them because there is a new item without an answer in that.

Thanks in advance,

Cor

"Kevin" <Ke****@nospam.cfl.rr.comschreef in bericht
news:q8********************************@4ax.com...
Never mind. I figured it out.

On Sat, 11 Nov 2006 02:09:51 GMT, Kevin <Ke****@nospam.cfl.rr.com>
wrote:
>>I'm trying to create a function that will return the length of a text
string in inches.

e.Graphics.MeasureString(mString, mFont)

Seems to be what I'm looking for, but I don't know how to pass
PaintEventArgs (e).

I don't want to use it in a paint event, I just want it to return a
number when I pass it a string and a font. How do I do this?

Nov 11 '06 #3

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

Similar topics

3
by: danny | last post by:
I have a function that when uses the form name works correctly. Should I pass a variable to the function using either BizReset('bizform') or BizReset(getElementById('bizform') statements I receive...
4
by: Erik Paul | last post by:
I got some maybe stupid questions about file output and functions. At first I have to say I'm programming on Linux. The first thing is I couldn't find a function which can tell me microseconds...
12
by: Crirus | last post by:
I need to measure how long a function take to execute... or a sequence of code within -- Ceers, Crirus ------------------------------ If work were a good thing, the boss would take it all...
0
by: aolba | last post by:
Hello, I hope I could get some help with this issue, since I give up. It is too much for just me. This script is originally from MX. I have a hard time trying to translate to AS3. Anyway. There...
1
by: prads | last post by:
Hello, I found this waitbar functioning pgm in a forum which does the same work as a matlab waitbar. However this pgm has an error and i cudnot figure it out. Can anyone pls correct it. Thanks,...
4
by: prads | last post by:
Hello, this waitbar function (similar to the one in matlab) in C++ pops an error. Pls correct the error for me. Thanks, prads <code> #include <octave/oct.h> #if defined (HAVE_TERM_H) # ...
2
by: WGW | last post by:
Hello all, I need another set of eyes cause it just isn't working, no matter how identical I make it. The initRotator function works when called by itself, but when adding another function, only the...
2
by: Mosfet | last post by:
Hi, I am currently writing a graphical control(a list control) that can display a picture followed by some text and to do so I first calculate an item height and then I really draw. I was...
1
by: faultykid | last post by:
I would like to store a variable then call it back later. I have a variable on line 198 www = ''+this._ad.clickUrl+''; and on line 321 i try document.write(www);
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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: 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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.