[Turn]cefsharp WPF Chinese input Problem solving method

Source: Internet
Author: User

Summary

Recently engaged in a client-side project, consider using WPF, inline WebView, to access the H5 page. So the Cefsharp component was used, but a problem was found, that is, when inputting Chinese, it cannot be entered.

Solutions

Went to the official GitHub search under, someone had met before, and resolved,

After downloading, rewrite the Onpreviewtextinput method and compile.

//CefSharp.Wpf.ChromiumWebBrowser Increaseprotected Override voidonpreviewtextinput (TextCompositionEventArgs e) {foreach(CharTinchE.text) {Managedcefbrowseradapter.sendkeyevent (int) WM. CHAR, (int) T,0);//or WM. Ime_char?                }            Base.        Onpreviewtextinput (e); } //The Sourcehook method comments out the case WM. CHAR:

Or listen to the Previewtextinput event to process the input content.

            varsetting =Newcefsharp.cefsettings ();            CefSharp.Cef.Initialize (setting); Chromiumwebbrowser WebView=NewCefSharp.Wpf.ChromiumWebBrowser (); Webview.previewtextinput+ = (obj, args) = =            {                foreach(varCharacterinchargs. Text) {//send each character to the browser component onceWebview.getbrowser (). GetHost (). Sendkeyevent ((int) WM. CHAR, (int) Character,0); }                //don't let CEF handle it on its owne.handled =true; };

But the above problem solved, there is still an input method candidate word location problem, cannot be located under the input box, the problem has not found a solution:

Resources

Http://www.cnblogs.com/wuya/p/cefsharp-wpf-chinese-input-mehond.html

Http://www.cnblogs.com/ShengM/p/5832458.html

[Turn]cefsharp WPF Chinese input Problem solving method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.