【发布时间】:2014-08-26 12:09:54
【问题描述】:
我正在制作System.Windows.Controls.TextBox。我需要它是System.Windows.Controls.TextBox,而不是System.Windows.Forms.TextBox,因为一个方法需要它来进行拼写检查。我已经弄清楚或查找了该控件的大多数其他属性,但在 Google、Stack Overflow 或 Microsoft 上都找不到。
这是我正在使用的代码:
this.tbSearch.Name = "tbSearch";
//this.tbSearch.LOCATION //this needs to be replaced
this.tbSearch.Width = 313;
this.tbSearch.Height = 20;
this.tbSearch.TabIndex = 2;
this.tbSearch.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.tbSearch_TextChanged);
感谢任何帮助!
编辑:
我正在使用 WinForms。
【问题讨论】:
-
有一些插件可以为
Forms.Textbox提供拼写检查属性。这可能更容易。 -
System.Windows.Controls类是 WPF 控件。您不能将 WPF 控件直接放在 WinForm 窗体中。您需要使用ElementHost控件“托管”它。 -
@krillgar 你有链接吗?谢谢!
-
@cullub 这是来自 MSDN 的 walkthrough。
-
NHunspell 是我过去使用的那个。使用起来相当容易。