PLS HELP: How to find ot if text fits a texbox/combobox

  • Thread starter Thread starter MuZZy
  • Start date Start date
M

MuZZy

Hi,

I need to add a tooltip to a textbox, but only if text doesn't fit the
textbox. So i need to somehow find out if text length is bigger than
width of a box. The problem i have is more generic, i need to add this
functionality to different tyes of controls/user controls, but i coud
start with a text box and go from there.

I spent a decent amount of time researching the web, but didn't find a
clue so far.

Any help would be highly appreciated!

Thank you in advance,
Andrey
 
Graphics.MeasureString() should do what you want. Measure the string, get
the width of the string, then compare it to the width of the textBox.
 

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