private void txtHtmlControl_AutoCorrect(object sender, DevExpress.XtraRichEdit.AutoCorrectEventArgs e) { AutoCorrectInfo info = e.AutoCorrectInfo; e.AutoCorrectInfo = null; if (info.Text.Length <= 0 || !info.Text.Contains(">")) { return; } if (info.Text[0] == '>') { for (;;) { if (!info.DecrementStartPosition()) { return; } if (info.Text[0] == '<') { string replaceString = info.Text + info.Text.Insert(1, "/"); if (!String.IsNullOrEmpty(replaceString)) { info.ReplaceWith = replaceString; e.AutoCorrectInfo = info; } return; } } } }
private void richEditControl1_AutoCorrect(object sender, DevExpress.XtraRichEdit.AutoCorrectEventArgs e) { AutoCorrectInfo info = e.AutoCorrectInfo; e.AutoCorrectInfo = null; if (info.Text.Length <= 0) { return; } for (; ;) { if (!info.DecrementStartPosition()) { return; } if (IsSeparator(info.Text[0])) { return; } if (info.Text[0] == '$') { info.ReplaceWith = CreateImageFromResx("dollar_pic.png"); e.AutoCorrectInfo = info; return; } if (info.Text[0] == '%') { string replaceString = CalculateFunction(info.Text); if (!String.IsNullOrEmpty(replaceString)) { info.ReplaceWith = replaceString; e.AutoCorrectInfo = info; } return; } } }