Property LineStyles
LineStyles
Represents an object that implements ILineStyles
interface holding collection of line styles for this document.
[Browsable(false)]
public virtual ILineStyles LineStyles { get; set; }
Property Value
Examples
Here is how to use a LineStyles in the C# code:
using System.Drawing;
using System.Windows;
using Alternet.Editor.Wpf;
public partial class MainWindow : Window
{
private TextSource textSource;
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var textEdit1 = new TextEditor();
var textEdit2 = new TextEditor();
textEdit1.LineStyles.AddLineStyle("bookmark", Color.White, Color.Red, Color.Empty, 12, LineStyleOptions.BeyondEol);
textEdit2.LineStyles.AddLineStyle("bookmark", Color.White, Color.Orange, Color.Empty, 12, LineStyleOptions.BeyondEol);
textSource = new TextSource();
textSource.LoadFile("myfile.txt");
textEdit1.Source = this.textSource;
textEdit2.Source = this.textSource;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
textSource.LineStyles.SetLineStyle(textSource.Position.Y, 0);
}
}
Here is how to use a LineStyles in the Visual Basic code:
Imports System.Drawing
Imports System.Windows
Imports Alternet.Editor.Wpf
Partial Public Class MainWindow
Inherits Window
Private textSource As TextSource
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim textEdit1 = New TextEditor()
Dim textEdit2 = New TextEditor()
textEdit1.LineStyles.AddLineStyle("bookmark", Color.White, Color.Red, Color.Empty, 12, LineStyleOptions.BeyondEol)
textEdit2.LineStyles.AddLineStyle("bookmark", Color.White, Color.Orange, Color.Empty, 12, LineStyleOptions.BeyondEol)
textSource = New TextSource()
textSource.LoadFile("myfile.txt")
textEdit1.Source = Me.textSource
textEdit2.Source = Me.textSource
End Sub
Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
textSource.LineStyles.SetLineStyle(textSource.Position.Y, 0)
End Sub
End Class
Remarks
Line styles are used to highlight individual text lines in the text displayed by the TextEditor control linked to this TextSource object.
Use <Alternet.Editor.Wpf.TextEditor.LineStyles> property to configure the appearance of individual line styles, such as background color or image displayed on the gutter area.