首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在没有用户干预的情况下用UltraSpellChecker触发红色陷阱?

如何在没有用户干预的情况下用UltraSpellChecker触发红色陷阱?
EN

Stack Overflow用户
提问于 2020-06-22 16:58:12
回答 1查看 51关注 0票数 0

非脆弱性文档说要将模式设置为AsYouType,当用户输入一个空格时,拼写检查器将创建squigglies。

我还看到了一个AsYouTypeManager类,但也不知道在哪里或如何使用它。网上的文档没那么好。

当一个盒子装载了数据并且它有错误时,我想让红色的squigglies出现而没有任何用户交互。我该怎么做?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-06 21:26:36

下面的示例演示了UltraSpellChecker必须如何初始化才能在没有任何用户交互的情况下显示红色的squiggles。

Form1.cs

代码语言:javascript
运行
复制
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

代码语言:javascript
运行
复制
#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,如不碎片整理文档中所述,上面的代码显示了以下形式:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62519632

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档