解决 CefSharp WPF控件不能使用输入法输入中文的问题(代码已提交到 github)
来源:互联网 发布:手机淘宝怎么注销店铺 编辑:程序博客网 时间:2024/06/10 02:02
首先,本文所有 代码已经提交到github,需要的可以直接从github获取:https://github.com/starts2000/CefSharp,希望可以帮助到有需要的朋友们。
CEF 简介
CEF is a BSD-licensed open source project founded by Marshall Greenblatt in 2008 and based on the Google Chromium project. Unlike the Chromium project itself, which focuses mainly on Google Chrome application development, CEF focuses on facilitating embedded browser use cases in third-party applications. CEF insulates the user from the underlying Chromium and Blink code complexity by offering production-quality stable APIs, release branches tracking specific Chromium releases, and binary distributions. Most features in CEF have default implementations that provide rich functionality while requiring little or no integration work from the user. There are currently over 100 million installed instances of CEF around the world embedded in products from a wide range of companies and industries. A partial list of companies and products using CEF is available on the CEF Wikipedia page. Some use cases for CEF include:
Embedding an HTML5-compliant Web browser control in an existing native application.
Creating a light-weight native “shell” application that hosts a user interface developed primarily using Web technologies.
Rendering Web content “off-screen” in applications that have their own custom drawing frameworks.
Acting as a host for automated testing of existing Web properties and applications.
CEF supports a wide range of programming languages and operating systems and can be easily integrated into both new and existing applications. It was designed from the ground up with both performance and ease of use in mind. The base framework includes C and C++ programming interfaces exposed via native libraries that insulate the host application from Chromium and Blink implementation details. It provides close integration between the browser and the host application including support for custom plugins, protocols, JavaScript objects and JavaScript extensions. The host application can optionally control resource loading, navigation, context menus, printing and more, while taking advantage of the same performance and HTML5 technologies available in the Google Chrome Web browser.
Numerous individuals and organizations contribute time and resources to support CEF development, but more involvement from the community is always welcome. This includes support for both the core CEF project and external projects that integrate CEF with additional programming languages and frameworks (see the "External Projects" section below). If you are interested in donating time to help with CEF development please see the "Helping Out" section below. If you are interested in donating money to support general CEF development and infrastructure efforts please visit the CEF Donations page.
CEF 的 .NET 开源项目主要有下面三个:
CefSharp:https://github.com/chillitom/CefSharp
cefglue:https://bitbucket.org/xilium/xilium.cefglue
chromiumfx:https://bitbucket.org/chromiumfx/chromiumfx
CEF osr IME BUG 历史
CefSharp 和 cefglue 都使用 C++/CLI 对 cef API 进行封装,都提供了 cef 的 Winform 和 WPF 控件,而 chromiumfx 使用 P/Invoke 对 cef API 进行封装,只提供了cef Winform 控件。CefSharp 和 cefglue 的 cef WPF 控件都使用 cef 的 osr ( off screen render)方式进行渲染,由于 osr 模式一直存在 IME BUG,所以 CefSharp 和 cefglue 的 WPF 控件也存在。
CEF osr IME bug 在 2012-11-22 就有人提出:https://bitbucket.org/chromiumembedded/cef/issues/798/out-of-focus-while-entering-ime,但是直到2016年底才解决https://bitbucket.org/chromiumembedded/cef/issues/1675/inline-ime-support-nstextinput-protocol-in,真是等的黄花菜都凉了。然而, CefSharp 和 cefglue 更是没能跟上 CEF 的脚步,这个 BUG 直到现在也没有解决,所有相关的 issue,回答都是建议在 WPF 中使用 Host WinForm 控件的方式使用 CEF。
CEF osr IME bug:
最近通过参考 cef 的 osr 示例的源码,通过移植和修改,终于实现了 CefSharp WPF 控件的 IME 输入,在这里分享给大家。
主要是在 CefSharp.Core 项目中增加了对 IME 消息及 CEF IME 相关的处理,还有就是 WPF 的 ChromiumWebBrowser 控件的相关代码修改。
相关文章:
基于CefSharp构建基于Chromium的应用程序
使用 CefSharp 在 C# App 中嵌入 Chrome 浏览器
原文地址:http://www.cnblogs.com/Starts_2000/p/cefharp-wpf-osr-ime.html
.NET社区新闻,深度好文,微信中搜索dotNET跨平台或扫描二维码关注
- 解决 CefSharp WPF控件不能使用输入法输入中文的问题(代码已提交到 github)
- 解决powerpoint2007下谷歌输入法不能输入中文的问题
- 解决Ubuntu输入法图标消失,不能输入中文的问题
- 解决Ubuntu输入法图标消失,不能输入中文的问题
- WPF中使用WebBrowser控件的刷新问题[已解决]
- emacs中文输入法不能输入的问题
- ubuntu14.04中文输入法问题,解决gvim不能输入中文
- 解决Ubuntu下Sublime text 2的中文输入问题(使用fcitx输入法)
- 终于解决了在控制台不能输入中文输入法的问题了
- Ubuntu 16.04解决WPS下搜狗输入法不能输入中文的问题
- 解决Ubuntu 16.04 搜狗输入法 只有悬浮窗,不能输入中文的问题
- ubuntu 下搜狗输入法不能输入中文解决
- 解决文本框在updatepanel中得到焦点,输入法不能切换到中文的问题
- 解决JIRA不能输入中文的问题
- 解决appium不能输入中文的问题
- 解决`向github提交代码是老要输入用户名密码`的问题
- Ubuntu下搜狗输入法不能输入中文问题
- 表单中文数据提交到MySQL数据库乱码问题(已解决)
- .NET Core快速入门教程 5、使用VS Code进行C#代码调试的技巧
- EF Core 插件 —— ToSql
- Entity Framework Core 执行SQL语句和存储过程
- DDD理论学习系列(10)-- 聚合
- 基于.net的微服务架构下的开发测试环境运维实践
- 解决 CefSharp WPF控件不能使用输入法输入中文的问题(代码已提交到 github)
- CAP 介绍及使用【视频】
- Microsoft使用.NET Core SDK遥测数据
- SQL Server 2017 RC1 现已实现 Linux 功能扩展
- 基于.NET CORE微服务框架 -谈谈Cache中间件和缓存降级
- 浅谈 EF CORE 迁移和实例化的几种方式
- 是什么使你留在你的公司
- Xamarin for iOS 11(一)
- Entity Framework Core 批处理语句