无法在运行时以编程方式影响 Scintilla 控制
我正在尝试在我正在处理的应用程序中使用 ScintillaNET 控件。我将控件拖放到窗体中并运行窗体。该控件出现在窗体上。这很好。此外,如果我在控件的属性编辑器中设置任何属性(例如,ConfigurationManager.Language),我就可以输入该语言并看到语法突出显示。
当我尝试以编程方式更改属性时,我遇到了问题。例如,我尝试将文件中的文本加载到表单中(我在表单的“加载”中执行此操作)。文本不显示。我似乎也无法显示行号或执行任何其他数量的任务(包括以编程方式更改语言)。
知道我可能做错了什么吗?即使像下面的代码这样简单的东西似乎也不起作用:
private void scintilla1_Load(object sender, EventArgs e)
{
scintilla1.ConfigurationManager.Language = "xml";
}
I'm attempting to use the ScintillaNET control in an application I am working on. I drag and drop the control into my form and run form. The control appears on the form. This is good. In addition, if I set any of the properties in the control's properties editor (ConfigurationManager.Language, for example), I am able to type in that language and see syntax highlighting occur.
Where I run into problems is when I attempt to change properties programmatically. For example, I attempt to load text from a file into the form (I'm doing this in the form's Load). The text doesn't display. I also can't seem to show the line numbers or do any other number of tasks (including programmatically change the Language).
Any idea what I may be doing wrong? Even something as simple as the code below doesn't seem to work:
private void scintilla1_Load(object sender, EventArgs e)
{
scintilla1.ConfigurationManager.Language = "xml";
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

只需添加
scintilla1.ConfigurationManager.Configure();
Simply add
scintilla1.ConfigurationManager.Configure();