0

How to Get The Maximum Characters can we writer on Form.Text that visible to the users.

Brian Mains
  • 50,520
  • 35
  • 148
  • 257
  • See [my answer here](http://stackoverflow.com/a/6045890/366904) for instructions. – Cody Gray - on strike Feb 27 '12 at 09:47
  • Dear all thanks for the answering the question, I need this because i have to write on the Left and Right side of the form.text, if i have the total characters so i easily add the space between the two strings and 2nd string will show on rightside –  Feb 27 '12 at 11:38
  • Since you are probably dealing with a proportinal font like Arial, you cannot generally say how many characters will fit on one line. Many i's will fit on the line, however only a few W's. These are ten i's, "iiiiiiiiii". These are ten W's, "WWWWWWWWWW". – Olivier Jacot-Descombes Feb 27 '12 at 15:20
  • That will not be possible. Not a big deal, though. There's absolutely *no* reason why you should have text appearing on *both* sides of a form's caption bar. Look at all the other programs on your computer. The text is only on one side. That's how it's supposed to be. If you want to do something else, you'll need to owner draw the caption bar, which is not a trivial undertaking. It's also extremely fragile, prone to breaking each time Microsoft upgrades the operating system, and pretty difficult to get right. There is a lot of behavior in the standard bar you won't adequately replicate. – Cody Gray - on strike Feb 27 '12 at 17:08

1 Answers1

1

You need the size, i guess :

Me.CreateGraphics().MeasureString("Some string", Me.Font)
Amen Ayach
  • 4,288
  • 1
  • 23
  • 23