문제

In Avalonedit, how do I get the line number of the very top line that is visible to the user?

I believe I'm supposed to make some use out of VisualLines but it isn't helping.

도움이 되었습니까?

해결책

You can use GetDocumentLineByVisualTop:

int firstLine = textView.GetDocumentLineByVisualTop(textView.ScrollOffset.Y).LineNumber;

textView.VisualLines[0].FirstDocumentLine.LineNumber would work as well, but you have to be careful there - the visual lines collection can be invalid if a redraw was requested but not performed yet (see VisualLinesValid/EnsureVisualLines()).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top