This repository has been archived by the owner on Jun 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyMemoEdit.vb
50 lines (37 loc) · 1.56 KB
/
MyMemoEdit.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Globalization
Imports DevExpress.XtraSpellChecker
Imports System.Windows.Forms
Imports System.ComponentModel.Design
Imports System.Drawing
Namespace CustomControl
Friend Class MyMemoEdit
Inherits DevExpress.XtraEditors.MemoEdit
Protected myMemoSpellChecker As New SpellChecker()
Public Sub New()
MyBase.New()
InitializeSpellChecker(Me, myMemoSpellChecker)
End Sub
Public Sub InitializeSpellChecker(ByVal control As Control, ByVal spellChecker As SpellChecker)
Dim usCulture As New CultureInfo("en-US")
spellChecker.Culture = usCulture
Dim sharedDictionaryStorage As New SharedDictionaryStorage()
Dim dictionary As New SpellCheckerOpenOfficeDictionary("en_US.dic", "en_US.aff", usCulture)
sharedDictionaryStorage.Dictionaries.Add(dictionary)
Dim customDictionary As New SpellCheckerCustomDictionary("custom_US.dic", usCulture)
sharedDictionaryStorage.Dictionaries.Add(customDictionary)
spellChecker.UseSharedDictionaries = True
Dim options As New OptionsSpelling()
options.IgnoreRepeatedWords = DevExpress.Utils.DefaultBoolean.False
options.IgnoreMixedCaseWords = DevExpress.Utils.DefaultBoolean.False
spellChecker.SetSpellCheckerOptions(control, options)
spellChecker.SpellCheckMode = SpellCheckMode.AsYouType
spellChecker.CheckAsYouTypeOptions.CheckControlsInParentContainer = True
spellChecker.ParentContainer = control
spellChecker.SetCanCheckText(control, True)
End Sub
End Class
End Namespace