I need to get the line height from rich text box...
I know for a fact that the fon't size is the same in all the line...
need API for it?
If so.. how?
thanks in advanced
Printable View
I need to get the line height from rich text box...
I know for a fact that the fon't size is the same in all the line...
need API for it?
If so.. how?
thanks in advanced
Hi Trojan,
There's probably an API, but the following works.
Add a pictureBox, set it to Visible=False and use the following code:
VB Code:
Picture1.ScaleMode = vbPixels Picture1.Font.Size = RichTextBox1.SelFontSize Picture1.Font.Name = RichTextBox1.SelFontName MsgBox Picture1.TextHeight(RichTextBox1.SelText)
Added bonus, if needed, Picture1.TextWidth(RichTextBox1.SelText) gets the width.