Hi,
We have a number of multiline, scrollable winforms texbox controls in .net 2.0 that need to implement pagination in order to allow the user to navigate their contents only by moving a single page (a full control's worth of text) at a time.
As part of this I need to get the number of full lines of text that can be visible on screen at any point to work out how many pages the textbox contains.
I'm fairly sure there isn't a windows message that will alow me to get this information directly, nor have I been able to work out an acceptible solution to this issue.
Below is the current solution we have implemented, this tends to occasionally give a rounding error of at least one line so it has been less than successful.
public int LinesPerPage
{
get
{
return (int)(this.Height / this.Font.Height);
}
}
Ideally I would like to know the algorithm used in drawing text to the control but if this isn't available and other suggestions people have would be greatly appreciated.
Thank you in advance,
Evan