如何在没有用户干预的情况下使用 UltraSpellChecker 触发红色波浪线?

How to trigger red squigglies with UltraSpellChecker without user intervention?

Infragistics 文档说将模式设置为 AsYouType,当用户键入 space 时,拼写检查器将创建波浪形。

我也看到有一个 AsYouTypeManager class 但也不知道在哪里或如何使用它。在线文档不是很好。

当一个盒子加载了数据并且出现错误时,我希望在没有任何用户交互的情况下出现红色波浪线。我该怎么做?

以下示例说明如何必须初始化 UltraSpellChecker 以在没有任何用户交互的情况下显示红色波浪线。

Form1.cs

private void Form1_Load(object sender, EventArgs e)
{
    // The extender property must be set for the rich text box so that it may be spell checked. 
    // This can also be done through the property grid in the forms designer
    this.ultraSpellChecker1.SetSpellCheckerSettings(this.rtbSpellChecked, new SpellCheckerSettings(true));
}

Form1.Designer.cs

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
    this.components = new System.ComponentModel.Container();
    this.rtbSpellChecked = new System.Windows.Forms.RichTextBox();
    this.ultraSpellChecker1 = new Infragistics.Win.UltraWinSpellChecker.UltraSpellChecker(this.components);
    ((System.ComponentModel.ISupportInitialize)(this.ultraSpellChecker1)).BeginInit();
    this.SuspendLayout();
    // 
    // rtbSpellChecked
    // 
    this.rtbSpellChecked.Dock = System.Windows.Forms.DockStyle.Fill;
    this.rtbSpellChecked.Location = new System.Drawing.Point(0, 0);
    this.rtbSpellChecked.Name = "rtbSpellChecked";
    this.rtbSpellChecked.Size = new System.Drawing.Size(411, 266);
    this.rtbSpellChecked.TabIndex = 5;
    this.rtbSpellChecked.Text = "UltraSpellChecker Class\nPerforms spel cheking on one or more conrols.";
    // 
    // ultraSpellChecker1
    // 
    this.ultraSpellChecker1.ContainingControl = this;
    this.ultraSpellChecker1.Mode = Infragistics.Win.UltraWinSpellChecker.SpellCheckingMode.AsYouType;
    this.ultraSpellChecker1.ShowDialogsModal = false;
    // 
    // Form1
    // 
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    this.ClientSize = new System.Drawing.Size(411, 266);
    this.Controls.Add(this.rtbSpellChecked);
    this.Name = "Form1";
    this.Text = "UltraSpellChecker";
    this.Load += new System.EventHandler(this.Form1_Load);
    
    ((System.ComponentModel.ISupportInitialize)(this.ultraSpellChecker1)).EndInit();
    this.ResumeLayout(false);

}

#endregion

private Infragistics.Win.UltraWinSpellChecker.UltraSpellChecker ultraSpellChecker1;
private System.Windows.Forms.RichTextBox rtbSpellChecked;

this.ultraSpellChecker1.Mode 设置为 SpellCheckingMode.AsYouType,如 Infragistics 文档中所述,上面的代码显示以下形式: