.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
The page you are viewing does not exist in the .NET Standard 2.0+ platform documentation. This link will take you to the parent topic of the current section.
.NET Core 3.0+

AutoCorrectEventArgs.AutoCorrectInfo Property

Gets or sets the AutoCorrectInfo object that provides methods to analyze input text and contains a replacement object.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.RichEdit.v19.2.Core.dll

Declaration

public AutoCorrectInfo AutoCorrectInfo { get; set; }
Public Property AutoCorrectInfo As AutoCorrectInfo
public AutoCorrectInfo AutoCorrectInfo { get; set; }
Public Property AutoCorrectInfo As AutoCorrectInfo

Property Value

Type Description
AutoCorrectInfo

An AutoCorrectInfo object.

Property Value

Type Description
AutoCorrectInfo

An AutoCorrectInfo object.

Remarks

The AutoCorrectInfo is the main source of information used in handling the AutoCorrect event.

The following code sample shows how to handle the RichEditControl.AutoCorrect event to replace the typed $ symbol with a picture of a dollar, and substitute the text enclosed in percent symbols with custom content.

Use the AutoCorrectEventArgs.AutoCorrectInfo property to obtain the document text, then call the AutoCorrectInfo.DecrementStartPosition method to expand its left boundary until a special symbol or a word separator symbol is found. Use the AutoCorrectInfo.ReplaceWith property to pass a replacement object (a string or an image) to the document if a resulting string meets certain conditions, such as whether it is a dollar sign or a %date% string.

Private Sub richEditControl1_AutoCorrect(ByVal sender As Object, ByVal e As DevExpress.XtraRichEdit.AutoCorrectEventArgs) Handles richEditControl1.AutoCorrect
    Dim info As AutoCorrectInfo = e.AutoCorrectInfo
    e.AutoCorrectInfo = Nothing

    If info.Text.Length <= 0 Then
        Return
    End If
    Do
        If Not info.DecrementStartPosition() Then
            Return
        End If

        If IsSeparator(info.Text(0)) Then
            Return
        End If

        If info.Text(0) = "$"c Then
            info.ReplaceWith = CreateImageFromResx("dollar_pic.png")
            e.AutoCorrectInfo = info
            Return
        End If

        If info.Text(0) = "%"c Then
            Dim replaceString As String = CalculateFunction(info.Text)
            If Not String.IsNullOrEmpty(replaceString) Then
                info.ReplaceWith = replaceString
                e.AutoCorrectInfo = info
            End If
            Return
        End If
    Loop
End Sub
See Also