Length to pixel transform

  • Thread starter Thread starter Pumkin
  • Start date Start date
P

Pumkin

Hello everyone...
I have a question for all of you cause sincerelly I'm stuck.
I have a string and I can get its length.
For example : The string ASP. The length is 3.
How can I know how many pixels is the length.

Thanks a lot in advanced,
 
Pumkin said:
Hello everyone...
I have a question for all of you cause sincerelly I'm stuck.
I have a string and I can get its length.
For example : The string ASP. The length is 3.
How can I know how many pixels is the length.

Thanks a lot in advanced,


Take a look at the MeasureString method of the System.Drawing.Graphics
class - you give it a string and a font object, and it returns you a
size.

http://msdn.microsoft.com/library/d...emdrawinggraphicsclassmeasurestringtopic1.asp
 
you can only know the size on the server, you will have to render it on the
client, and use javascript to estimate the length (as the browser does not
expose and api for this).

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top