0

How I can calculate correct height of text inside multi-line text-box and space around lines and text? I need to enable scrollbar programmatically.

Karolis Koncevičius
  • 9,417
  • 9
  • 56
  • 89
Ramesh
  • 438
  • 4
  • 13
  • You mean something like this: http://stackoverflow.com/questions/2893059/autoresize-textbox-control-vertically – Shannon Holsinger Sep 06 '16 at 05:33
  • There are a couple of other methods discussed on different posts here on SO. I'm pretty sure one of them will have what you want (or as close to what you want as is possible). Good luck! – Shannon Holsinger Sep 06 '16 at 05:56
  • I think , I had already tried for above link , TextRenderer.MeasureString(text, textBox.Font).ToSize(); but maybe because of devexpress control not getting correct size – Ramesh Sep 06 '16 at 06:00
  • I am overriding text property of windows form text-box and enabling scrollbar in property if text exceeded height of text-box – Ramesh Sep 06 '16 at 06:07
  • TextFormatFlags.TextBoxControl was explicitly designed to deal with the somewhat quirky way in which TextBox formats its text. It is the oldest control in the toolbox, 30 years already, time hasn't been that kind to it. – Hans Passant Sep 08 '16 at 15:38

0 Answers0