解决 CefSharp WPF控件不能使用输入法输入中文的问题(代码已提交到 github)

首先,本文所有 代码已经提交到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 开源项目主要有下面三个:

  1. CefSharp:https://github.com/chillitom/CefSharp

  2. cefglue:https://bitbucket.org/xilium/xilium.cefglue

  3. 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跨平台或扫描二维码关注

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/324368.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ssl1747-登山机器人【离散化,玄学,贪心】

正题 大意 有n个机器人,每个机器人带xi点能量,行走需要消耗yi点能量,求这个n个机器人不回头的接力最多能走多远(一个走到就行了)。 解题思路 好像不是很难,处理接力时油的交接就好了。 假设现在有两个机…

java中的泛型类型擦除

大家好,我是雄雄,今天给大家分享的是:java的泛型是类型擦除的。写在前面那么何为类型擦除?类型擦除就是在编译期明确去掉所编程序的类型系统。啥?还不明白?以java泛型为例,java的泛型在编译期有…

性能优化之抛弃Calendar

转载自 性能优化之抛弃Calendar 目前在做限流相关的需求,有这么一个限流策略,和用户相关,当系统发生故障时,允许一个非核心接口按照用户的百分比进行限流,如果完全按照UUID进行hash,那么每次都是限制同一…

基于.net的微服务架构下的开发测试环境运维实践

眼下,做互联网应用,最火的架构是微服务,最热的研发管理就是DevOps, 没有之一。微服务、DevOps已经被大量应用,它们已经像传说中的那样,可以无所不能。特来电云平台,通过近两年多的实践&#xff…

洛谷P3845-球赛【离散化,贪心】

正题 题目连接: https://www.luogu.org/problemnew/show/P3845 AC信息: https://www.luogu.org/record/show?rid6955910 大意 有一些比分记录,不过双方可能会搞反(如1−21−2可能会记录成2−12−1)求这之间至少有…

挺详细的spring+springmvc+mybatis配置整合|含源代码

大家好,我是雄雄,今天来带着大家来配置一下SSM(springspringmvcmybatis)框架。01新建java web项目直接在myeclipse中,新建一个web项目即可。02导入jar包将SSM所需的jar包复制到项目的/WebRoot/WEB-INF/lib中&#xff0…

Java中如何实现线程的超时中断

转载自 Java中如何实现线程的超时中断 背景 之前在实现熔断降级组件的时候,需要实现接口请求的超时中断。意思是,业务在使用熔断降级功能时,在平台上设置了一个超时时间,如果请求进入熔断器开始计时,接口在超时时间…

GDOI2018-《被虐记》

序章 五一劳动节当然是来劳动的啦!于是乎五一就变成一件不存在的事,放学那天的中午就坐车去中山了。 然后睡了一会就快到了,下了高速,突然想起来这次带来手机就照了一张照。然后就到酒店了。附近也有挺多吃的,酒店一…

DDD理论学习系列(10)-- 聚合

1.引言 聚合,最初是UML类图中的概念,表示一种强的关联关系,是一种整体与部分的关系,且部分能够离开整体而独立存在,如车和轮胎。 在DDD中,聚合也可以用来表示整体与部分的关系,但不再强调部分…

#面试!,一定要注意,避免踩这些雷!!

大家好,我是雄雄。前言今天,对2班的同学们进行了模拟面试,由于学生们第一次参与模拟面试,所以会出现各种各样的问题,有应该出的,也有不该出的,现在做个简单的总结,供三班的孩子们参考…

一次动态代理的填坑之旅

转载自 一次动态代理的填坑之旅 背景 想在现有的接口加上熔断降级或者限流的功能,比较好的方式是通过注解的方式,并基于动态代理进行实现,下面代码是Rhino的实现 Rhino public class ServiceImpl {Degrade(rhinoKey "syncMethod-0&…

3班的第一次模拟面试

大家好,我是雄雄,前几天总结了下面试别的班时所出现的问题,今天,3班进行了第一次模拟面试。虽然在面试之前千叮咛万嘱咐,但是在正式模拟面试时还是有些问题。一方面由于这样的模拟面试以前没有过,所以紧张过…

漫画:如何实现大整数相加

转载自 漫画:如何实现大整数相加 在程序中列出的 “竖式” 究竟是什么样子呢?我们以 426709752318 95481253129 为例,来看看大整数相加的详细步骤: 第一步,把整数倒序存储,整数的个位存于数组0下标位置&…

ssl2644-线段树练习1【线段树】

正题 题意 一块长m的墙&#xff0c;有n个大小不同的盒子放在前面&#xff0c;求没有被挡住的墙的总长度 解题思路 用线段树&#xff0c;0表示有没被遮挡的&#xff0c;1表示完全被遮挡&#xff0c;-1表示有遮挡的和没遮挡的。然后记数。 代码 #include<cstdio> usin…

Entity Framework Core 执行SQL语句和存储过程

无论ORM有多么强大&#xff0c;总会出现一些特殊的情况&#xff0c;它无法满足我们的要求。在这篇文章中&#xff0c;我们介绍几种执行SQL的方法。 表结构 在具体内容开始之前&#xff0c;我们先简单说明一下要使用的表结构。 public class Category{ public …

我去,终于解决了!

大家好&#xff0c;我是雄雄。今天给大家带来的是【IntelliJ IDEA中配置SSM框架总是报错&#xff0c;启动不了Tomcat的解决方法】。前言以前不管是在开发还是在授课&#xff0c;使用的软件要么是eclipse&#xff0c;要么就是myeclipse&#xff0c;最近听闻身边的人都在用idea,并…