
Current number of lines visible in RichTextBox????
You can get an approximation using
Form1.Font = RichTextBox1.Font
Form1.FontSize = RichTextBox1.Font.Size
Debug.Print RichTextBox1.Height / TextHeight("W")
Be aware, however, there is no "exact" answer because a RichTextBox can be
sized in such a way that on part of the last line is visible. In any event,
you can play around with various rounding options to get what you want.
(Another possible fly in the ointment is if you use text of differing sizes,
then the above won't work.)
Rick
Quote:
> How can you tell how many lines are currently being displayed
> (visible) in a RichTextBox?
> This can vary based on which font size is used, so it does not seem
> straight forward to figure out? Am I forced to calculate this value
> based on the current font point size and the known height of the
> RichTextBox? There must be an easier way.
> UncleT