Легко добавить функцию самостоятельно:
1) Перейдите в пространство имен ICSharpCode.TextEditor
и откройте класс TextAreaControl
. Расположение файла: C: ... \ ICSharpCode.TextEditor \ Project \ Src \ Gui \ TextAreaControl.cs
2) Добавьте метод для установки видимости горизонтальной или вертикальной полосы прокрутки:
public void ShowScrollBars(Orientation orientation,bool isVisible)
{
if (orientation == Orientation.Vertical)
{
vScrollBar.Visible = isVisible;
}
else
{
hScrollBar.Visible = isVisible;
}
}
3) В проекте с TextEditor вы вызываете метод ShowScrollBars()
:
editor.ActiveTextAreaControl.ShowScrollBars(Orientation.Vertical,false);
Этот код позволяет показать вертикальную полосу прокрутки в зависимости от количества строк текста:
public TextEditorForm()
{
InitializeComponent();
AddNewTextEditor("New file");
SetSyntaxHighlighting("Mathematica");
editor.ActiveTextAreaControl.TextEditorProperties.IndentationSize = 0;
editor.ActiveTextAreaControl.ShowScrollBars(Orientation.Vertical,false);
editor.TextChanged += new EventHandler(editor_TextChanged);
}
void editor_TextChanged(object sender, EventArgs e)
{
bool isVisible = (editor.ActiveTextAreaControl.GetTotalNumberOfLines > editor.ActiveTextAreaControl.TextArea.TextView.VisibleLineCount);
editor.ActiveTextAreaControl.ShowScrollBars(Orientation.Vertical, isVisible);
}
В TextAreaControl:
public int GetTotalNumberOfLines()
{
return this.Document.TotalNumberOfLines;
}
ps Я использую этот код проекта ICSharpCode-TextEditor проект.