非脆弱性文档说要将模式设置为AsYouType,当用户输入一个空格时,拼写检查器将创建squigglies。
我还看到了一个AsYouTypeManager类,但也不知道在哪里或如何使用它。网上的文档没那么好。
当一个盒子装载了数据并且它有错误时,我想让红色的squigglies出现而没有任何用户交互。我该怎么做?
发布于 2020-12-06 13:26:36
下面的示例演示了UltraSpellChecker
必须如何初始化才能在没有任何用户交互的情况下显示红色的squiggles。
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
,如不碎片整理文档中所述,上面的代码显示了以下形式:
https://stackoverflow.com/questions/62519632
复制