【问题标题】:GetText function in Webview2 in a .net framework WPF application.net 框架 WPF 应用程序中 Webview2 中的 GetText 函数
【发布时间】:2021-05-31 07:26:12
【问题描述】:

我最近在 Webview2 上试用 ace 编辑器之类的编辑器,因为 cefsharp 非常耗电。我的问题是我似乎没有找到一种方法来使用 C# 代码在编辑器中获取文本,似乎没有包含任何功能,而且我已经研究了大约一天,但我还没有找到任何结果。

【问题讨论】:

    标签: wpf webview2


    【解决方案1】:

    尝试使用 ace api,很确定它有一个 GetText 函数。 编辑,

    您可以使用这样的函数来获取文本并将其打印到文本框:

    // Note to you idk.xyz, use sx.Execute(EditorText);
    String EditorText = Json.Decode(await 
    Editor.ExecuteScriptAsync("GetText();"));
    // The line below just proves that it gets the text in the ace editor.
    aaaa.Text = EditorText;
    

    我将链接一个项目,其中也有一个例子: https://anonfiles.com/f7z9Lby3u6/testts_rar

    编辑:感谢投票❤

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-04
      • 1970-01-01
      • 2014-05-24
      • 1970-01-01
      • 2011-04-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多