public void EraseColorSegment() { if (CurrentCodeFile == null || AvalonEditor.SelectionLength == 0) { return; } CurrentCodeFile.EraseColorSegment(AvalonEditor.SelectionStart, AvalonEditor.SelectionStart + AvalonEditor.SelectionLength); // Ставим каретку в начало выделения AvalonEditor.SelectionLength = 0; Redraw(); }
// ---------------------------------------------------------------------------------------- public void AddColorSegment(SolidColorBrush color) { if (CurrentCodeFile == null || AvalonEditor.SelectionLength == 0) { return; } // Стираем все, что было на этом месте CurrentCodeFile.EraseColorSegment(AvalonEditor.SelectionStart, AvalonEditor.SelectionStart + AvalonEditor.SelectionLength); // Рисуем там же новый цвет CurrentCodeFile.AddColorSegment(AvalonEditor.SelectionStart, AvalonEditor.SelectionStart + AvalonEditor.SelectionLength, color); // Ставим каретку в начало выделения AvalonEditor.SelectionLength = 0; Redraw(); }