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