(NET) NET (2019)

<< Multi Languages Spell Checker for webmaster. Part 4. TheArtOfDev.HtmlRenderer. <<


Sorry, no time for more details description, only code.



   1:  Imports System.ComponentModel
   2:  Imports TheArtOfDev.HtmlRenderer.Core.Entities
   3:   
   4:  Public Class BrowserForm
   5:   
   6:      Dim WithEvents HtmlPanel As TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel
   7:      Dim HtmlTxt1 As String
   8:      Dim WorkingFileName As String
   9:      Dim WithEvents BGW1 As BackgroundWorker
  10:      Dim BGW1_Prm As New Object
  11:   
  12:      Public Sub BrowseNewFile(FileName As String)
  13:          WorkingFileName = FileName
  14:          BGW1 = New BackgroundWorker
  15:          BGW1_Prm = New With {FileName}
  16:          BGW1.RunWorkerAsync(BGW1_Prm)
  17:      End Sub
  18:   
  19:      Private Sub BrowserForm_Load(sender As Object, e As EventArgs) Handles Me.Load
  20:          HtmlPanel = New TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel
  21:          HtmlPanel.BackColor = System.Drawing.SystemColors.Control
  22:          HtmlPanel.BorderStyle = BorderStyle.Fixed3D
  23:          HtmlPanel.Dock = DockStyle.Fill
  24:          ToolStripContainer1.ContentPanel.Controls.Add(HtmlPanel)
  25:      End Sub
  26:   
  27:      Private Sub RefrestToolStripButton_Click(sender As Object, e As EventArgs) Handles RefrestToolStripButton.Click
  28:          BrowseNewFile(WorkingFileName)
  29:      End Sub
  30:   
  31:      Private Sub BGW1_DoWork(sender As Object, e As DoWorkEventArgs) Handles BGW1.DoWork
  32:          HtmlTxt1 = My.Computer.FileSystem.ReadAllText(e.Argument.FileName)
  33:      End Sub
  34:   
  35:      Private Sub BGW1_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BGW1.RunWorkerCompleted
  36:          HtmlPanel.Text = HtmlTxt1
  37:          HtmlPanel.Refresh()
  38:      End Sub
  39:   
  40:      Private Sub HtmlPanel_Click(sender As Object, e As EventArgs) Handles HtmlPanel.Click
  41:          Dim Renderer = CType(sender, TheArtOfDev.HtmlRenderer.WinForms.HtmlPanel)
  42:          SelectedTXT = Renderer.SelectedText
  43:          Text = "HTML Browser (" & Len(Renderer.SelectedText) & " chars selected)"
  44:      End Sub
  45:   
  46:      Dim SelectedTXT As String
  47:      Private Sub SpellCkeckToolStripButton_Click(sender As Object, e As EventArgs) Handles SpellCkeckToolStripButton.Click
  48:          If String.IsNullOrEmpty(SelectedTXT) Then
  49:              AutoClosingMessageBox.Show("Nothing text to spell checking")
  50:          Else
  51:              Dim X As MainForm = ParentForm
  52:              X.Spell(SelectedTXT)
  53:          End If
  54:   
  55:      End Sub
  56:   
  57:      Private Sub HtmlPanel_RenderError(sender As Object, e As HtmlRenderErrorEventArgs) Handles HtmlPanel.RenderError
  58:          AutoClosingMessageBox.Show(e.Message)
  59:      End Sub
  60:   
  61:  End Class


Comments ( )
Link to this page: //www.vb-net.com/SpellChecker/HtmlRenderer.htm
< THANKS ME>