Sign in to follow this  
Followers 0
VorDa

Get length of inputed text in pixels?

3 posts in this topic

How to split-get inputed text from input-edit control by pixels?

input control have length 400pixels, how to get from it 200pixels text?(not 200 characters)

Or convert pixels to characters and get number of characters?

Any idea?

 

Share this post


Link to post
Share on other sites



How to split-get inputed text from input-edit control by pixels?

input control have length 400pixels, how to get from it 200pixels text?(not 200 characters)

Or convert pixels to characters and get number of characters?

Any idea?

I believe that font can make that very variable. Imprecise.

At least that, be defined.

Share this post


Link to post
Share on other sites

You could get an approximation. Choose a fixed width font and based on the font size you choose, record the pixel width of a single character. Then just multiple the width by the length of your string.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0