Hello!, I implement a spell check control using a custom (spanish) dictionary without problem using Telerik UI for WinForms R3 2017.
But now, I need to implement the same functionality using Telerik UI for WinForms Q1 2015 (SpellChecker.dll version 2015.1.225.40) and I can't compile my code:
Thank you in advance!
'----------------------------------------------------------------------------------------
' Diccionario espanol para uso con SpellChecker
'----------------------------------------------------------------------------------------
Public
Shared
ReadOnly
CulturaEspanol
As
Globalization.CultureInfo = Globalization.CultureInfo.GetCultureInfo(
"es-ES"
)
'----------------------------------------------------------------------------------------
' Diccionario espanol para uso con SpellChecker
'----------------------------------------------------------------------------------------
Public
Class
MySpanishDictionary
Inherits
Telerik.WinControls.SpellChecker.Proofing.WordDictionary
Protected
Overrides
Sub
EnsureDictionaryLoadedOverride()
Dim
ls_dicpath
As
String
Try
ls_dicpath = My.Application.Info.DirectoryPath &
"\es-ES.tdf"
If
Not
File.Exists(ls_dicpath)
Then
frmError.MostrarDialogo(System.Reflection.MethodBase.GetCurrentMethod,
New
Exception(ls_dicpath &
" No Existe!."
))
Exit
Sub
End
If
Using lb_ms
As
System.IO.MemoryStream =
New
System.IO.MemoryStream(File.ReadAllBytes(ls_dicpath))
Me
.Load(lb_ms)
End
Using
Catch
ex
As
Exception
frmError.MostrarDialogo(System.Reflection.MethodBase.GetCurrentMethod, ex)
End
Try
End
Sub
End
Class
'----------------------------------------------------------------------------------------
' Setea Diccionario espanol para uso con SpellChecker
'----------------------------------------------------------------------------------------
Public
Shared
Sub
setearDiccionario(
ByRef
ao_spcControl
As
Telerik.WinControls.UI.RadSpellChecker)
Try
Dim
lo_textBoxControlSpellChecker
As
Telerik.WinControls.UI.TextBoxSpellChecker = ao_spcControl.GetControlSpellChecker(
GetType
(Telerik.WinControls.UI.RadTextBox))
lo_textBoxControlSpellChecker.ShowAllCapitalLettersWord =
True
Dim
lo_documentSpellChecker
As
Telerik.WinControls.SpellChecker.Proofing.DocumentSpellChecker = TryCast(lo_textBoxControlSpellChecker.SpellChecker, Telerik.WinControls.SpellChecker.Proofing.DocumentSpellChecker)
lo_documentSpellChecker.SpellCheckingCulture = CulturaEspanol
lo_documentSpellChecker.AddDictionary(
New
MySpanishDictionary(), CulturaEspanol)
Catch
ex
As
Exception
frmError.MostrarDialogo(System.Reflection.MethodBase.GetCurrentMethod, ex)
End
Try
End
Sub
.... at form you can use it:
'-----------------------------------------------------------------------
' Spell Check "as you type" en componente texto observaciones
' spcCheck is RadSpellChecker
' txtObservaciones is RadTextBox
'-----------------------------------------------------------------------
spcCheck.AutoSpellCheckControl = txtObervaciones
FG.Controles.Comunes.setearDiccionario(spcCheck)