Imports System Imports System.Drawing Imports System.Collections Imports System.ComponentModel Imports System.Windows.Forms Imports System.Data Imports DevExpress.XtraEditors Imports DevExpress.XtraEditors.Repository Imports DevExpress.XtraEditors.Registrator Namespace DevExpress_Grid _ '/ '/ Paints the AYT Text Box when not in edit mode - this code draws the red "e" in the corner of the cell. '/ Public Class AYTTextEditPainter Inherits DevExpress.XtraEditors.Drawing.TextEditPainter Protected Overrides Sub DrawString(ByVal info As DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs, ByVal bounds As Rectangle, ByVal [text] As String, ByVal appearance As DevExpress.Utils.AppearanceObject) If Not (RepositoryItemAYTTextEdit.RapidSpell Is Nothing) Then 'use the core spell checker from the as you type object Dim rsc As Keyoti.RapidSpell.RapidSpellChecker = RepositoryItemAYTTextEdit.RapidSpell.RapidSpellChecker rsc.ShareDictionary = True rsc.WarnDuplicates = False 'check the text for errors rsc.Check([text]) If Not (rsc.NextBadWord() Is Nothing) Then 'if errors are present then draw a red 'e' in the corner info.Graphics.DrawString("e", New Font("Arial", 7), System.Drawing.Brushes.Red, New PointF(info.Bounds.Right - 7, info.Bounds.Top)) End If End If MyBase.DrawString(info, bounds, [text], appearance) End Sub 'DrawString End Class 'AYTTextEditPainter '/ '/ As You Type TextEdit repository item '/ _ Public Class RepositoryItemAYTTextEdit Inherits DevExpress.XtraEditors.Repository.RepositoryItemTextEdit '/ '/ Shared instance of the spell checker '/ Public Shared RapidSpell As Keyoti.RapidSpell.RapidSpellAsYouType '/ '/ Needs to be called in Form .ctor '/ Public Shared Sub InitRapidSpellAsYouType() RepositoryItemAYTTextEdit.RapidSpell = New Keyoti.RapidSpell.RapidSpellAsYouType RepositoryItemAYTTextEdit.RapidSpell.UserDictionaryFile = "user-dic.txt" RepositoryItemAYTTextEdit.RapidSpell.IncludeUserDictionaryInSuggestions = True RepositoryItemAYTTextEdit.RapidSpell.ShowSuggestionsWhenTextIsSelected = True End Sub 'InitRapidSpellAsYouType Public Shared EditorName As String = "AYTTextEdit" Public Shared Sub Register() EditorRegistrationInfo.Default.Editors.Add(New EditorClassInfo(EditorName, GetType(AYTTextEdit), GetType(RepositoryItemAYTTextEdit), GetType(DevExpress.XtraEditors.ViewInfo.TextEditViewInfo), New AYTTextEditPainter, True, CType(Nothing, System.Drawing.Image))) End Sub 'Register 'uncomment for regular painter new DevExpress.XtraEditors.Drawing.TextEditPainter(), Public Overrides ReadOnly Property EditorTypeName() As String Get Return EditorName End Get End Property Shared Sub New() Register() End Sub 'New End Class 'RepositoryItemAYTTextEdit _ '/ '/ As You Type TextEdit '/ Public Class AYTTextEdit Inherits DevExpress.XtraEditors.TextEdit Shared Sub New() RepositoryItemAYTTextEdit.Register() End Sub 'New Public Overrides ReadOnly Property EditorTypeName() As String Get Return RepositoryItemAYTTextEdit.EditorName End Get End Property Public Shadows ReadOnly Property Properties() As RepositoryItemAYTTextEdit Get Return MyBase.Properties End Get End Property '/ '/ The inner text box '/ Private aytBox As Keyoti.RapidSpell.DevExpressAdapter.AYTTextBoxMaskBox Protected Overrides Function CreateMaskBoxInstance() As TextBoxMaskBox 'create a new instance of the textbox and assign it to the spell checker Dim rsayt As Keyoti.RapidSpell.RapidSpellAsYouType rsayt = RepositoryItemAYTTextEdit.RapidSpell aytBox = New Keyoti.RapidSpell.DevExpressAdapter.AYTTextBoxMaskBox(Me) rsayt.RapidSpellChecker.ShareDictionary = True rsayt.TextComponent = aytBox aytBox.UnderlineYOffset = 0 'use single underlines because not enough room for wavy rsayt.UnderlineStyle = Keyoti.RapidSpell.UnderlineStyle.Single Return aytBox End Function 'CreateMaskBoxInstance End Class 'AYTTextEdit End Namespace 'DevExpress_Grid