Imports System
Imports System.ComponentModel
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text

Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Actions
Imports DevExpress.Persistent.Base

Imports DevExpress.XtraEditors
Imports DevExpress.ExpressApp.HtmlPropertyEditor.Win

Public Class HTMLEditorVC
    Inherits DevExpress.ExpressApp.ViewController(Of DetailView)

    Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()
        RegisterActions(components)

    End Sub

    Protected Overrides Sub OnActivated()
        MyBase.OnActivated()
        For Each editor As HtmlPropertyEditor In View.GetItems(Of HtmlPropertyEditor)()

            AddHandler editor.CustomizeHtmlHeader, AddressOf HTMLEditor_CustomizeHtmlHeader
        Next editor
    End Sub
    Protected Overrides Sub OnDeactivated()
        MyBase.OnDeactivated()
        For Each editor As HtmlPropertyEditor In View.GetItems(Of HtmlPropertyEditor)()

            RemoveHandler editor.CustomizeHtmlHeader, AddressOf HTMLEditor_CustomizeHtmlHeader
        Next editor
    End Sub
    Private Sub HTMLEditor_CustomizeHtmlHeader(sender As Object, e As CustomizeHtmlHeaderEventArgs)
        e.HeaderInnerHtml = "<style>"
        e.HeaderInnerHtml += " * { font-family: Arial; }"
        e.HeaderInnerHtml += " h1 { color: #8080a0; font-weight: normal; padding: 0px; margin: 5px 0px; }"
        e.HeaderInnerHtml += " p { padding: 0px; margin: 3px 0px; color: #808080; }"
        e.HeaderInnerHtml += " </style>"
    End Sub

End Class
