在 VB.NET 上使用 ICSharpCode.TextEditor

发布于 2024-07-25 11:08:01 字数 129 浏览 4 评论 0原文

我已将 ICSharpCode.TextEditor 集成到 VB.NET 中,它运行顺利,没有错误。 但是,我在属性窗口中找不到用于启用或选择语法突出显示功能以及智能感知的属性。 我没有任何 ICSTE 的经验,所以请帮助我。 感谢您。

I've integrated ICSharpCode.TextEditor into VB.NET and it run smoothly without error. But, I cannot find in properties window the property to enable or select the syntax highlighting features as well as intellisense. I don't have any experience with ICSTE, so please help me. Thanks you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

躲猫猫 2024-08-01 11:08:01

这是我项目中的代码

//Initialize HM
HighlightingManager.Manager.AddSyntaxModeFileProvider(new FileSyntaxModeProvider(AppDomain.CurrentDomain.BaseDirectory));

//Setup current Highlighter

IHighlightingStrategy highlighter = HighlightingManager.Manager.FindHighlighter("SQL");
txtQuery.Document.HighlightingStrategy = highlighter;

确保文件 SQL.xshd 存在于 AppDomain.CurrentDomain.BaseDirectory

至于 entellisense 您应该使用此代码自己实现它

private void ShowCompletionWindow(ICompletionDataProvider completionDataProvider, char ch)
        {

            try
            {
                codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(
                    this,
                    codeEditorControl,
                    "<code>",
                    completionDataProvider,
                    ch);
                if (codeCompletionWindow != null)
                {
                    codeCompletionWindow.Closed += delegate
                                                    {
                                                        _blockKeys = false;
                                                    };

                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }

Here is code from my project

//Initialize HM
HighlightingManager.Manager.AddSyntaxModeFileProvider(new FileSyntaxModeProvider(AppDomain.CurrentDomain.BaseDirectory));

//Setup current Highlighter

IHighlightingStrategy highlighter = HighlightingManager.Manager.FindHighlighter("SQL");
txtQuery.Document.HighlightingStrategy = highlighter;

Ensure that file SQL.xshd exists in AppDomain.CurrentDomain.BaseDirectory

As for entellisense you should implement it mostly yourself using this code

private void ShowCompletionWindow(ICompletionDataProvider completionDataProvider, char ch)
        {

            try
            {
                codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(
                    this,
                    codeEditorControl,
                    "<code>",
                    completionDataProvider,
                    ch);
                if (codeCompletionWindow != null)
                {
                    codeCompletionWindow.Closed += delegate
                                                    {
                                                        _blockKeys = false;
                                                    };

                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
油焖大侠 2024-08-01 11:08:01

请参阅 github 上的此项目:ICSharpCode.TextEditorEx 和 nuget:ICSharpCode.TextEditorEx

此版本公开了一个属性 SyntaxHighlighting,您可以在设计器模式下使用该属性来设置语法突出显示。

See this project on github : ICSharpCode.TextEditorEx and nuget : ICSharpCode.TextEditorEx

This version exposes a property SyntaxHighlighting which you can use on designer mode to set the syntax highlighting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文