Table of Contents

Property VisualTheme

Namespace
Alternet.Editor
Assembly
Alternet.Editor.v9.dll

VisualTheme

Gets or sets visual theme for the editor.

[Browsable(false)]
public IVisualTheme VisualTheme { get; set; }

Property Value

IVisualTheme

Examples

Here is how to set a VisualTheme different VisualTheme from the C# code:

public partial class Form1 : Form
{
    private void Form1_Load(object sender, EventArgs e)
    {
        var syntaxEdit1 = new Alternet.Editor.SyntaxEdit(this.components);
        syntaxEdit1.VisualThemeType = Alternet.Editor.VisualThemeType.Custom;
        syntaxEdit1.VisualTheme = CustomVisualTheme.Instance;
    }
}

public class CustomVisualTheme
    : Alternet.Editor.StandardVisualTheme
{
    public static readonly CustomVisualTheme Instance = new CustomVisualTheme();

    public CustomVisualTheme()
        : base("Custom")
    {
    }

    protected override VisualThemeColors GetColors()
    {
        var colors = DarkVisualTheme.Instance.Colors.Clone();
        colors.Reswords = Color.Red;
        colors.WindowBackground = Color.FromArgb(40, 40, 40);
        return colors;
    }
}

Here is how to set a VisualTheme different VisualTheme from the Visual Basic code:

Partial Public Class Form1
    Inherits Form

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim syntaxEdit1 = New Alternet.Editor.SyntaxEdit(Me.components)
        syntaxEdit1.VisualThemeType = Alternet.Editor.VisualThemeType.Custom
        syntaxEdit1.VisualTheme = CustomVisualTheme.Instance
    End Sub
End Class

Public Class CustomVisualTheme
    Inherits Alternet.Editor.StandardVisualTheme

    Public Shared ReadOnly Instance As CustomVisualTheme = New CustomVisualTheme()

    Public Sub New()
        MyBase.New("Custom")
    End Sub

    Protected Overrides Function GetColors() As VisualThemeColors
        Dim Colors As VisualThemeColors = DarkVisualTheme.Instance.Colors.Clone()
        Colors.Reswords = Color.Red
        Colors.WindowBackground = Color.FromArgb(40, 40, 40)
        Return Colors
    End Function
End Class

Remarks

Use this property to set the color theme that specifies fonts and colors for all SyntaxEdit visual elements and dialog boxes.

Two color themes are supported out of the box: Light and Dark. Set this value to a custom theme to provide customized fonts and colors.