当前位置:网站首页>通过WinForm控件创建的WPF控件无法输入的问题
通过WinForm控件创建的WPF控件无法输入的问题
2022-04-22 00:36:00 【爱编程的小菜媛】
用英文输入法无法输入数字,非要切换到中文输入法才行;
虽然这个程序是个WPF程序,但为了复用之前的部分代码,使用着一个WinForm的菜单控件,后续的子窗口都是通过这个WinForm菜单创建的。而用WinForm控件创建的WPF控件可能出现无法正确响应键盘事件的情况。
找到了原因后,一个常规的解决方法是:将WinForm控件换成WPF控件,如果WinForm控件比较容易替换的话用这种方式是可以一次性的解决问题的。但如果要复用之前的控件,则可以使用如下函数使能WinForm创建的窗口或使用了WinForm创建的控件的窗口。
System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(winWPF);
版权声明
本文为[爱编程的小菜媛]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_52475977/article/details/124191372
边栏推荐
- What are the advantages of an automated testing framework?
- Cookie & session learning
- Muduo project introduction
- Beauty salon management system based on SSM (with source code + project display)
- MySQL basic collection
- A simple and easy-to-use file upload scheme
- Kotlin - 高阶函数介绍
- Addition, deletion, modification and query of advanced MySQL data (DML)
- Application of intelligent traversal test in regression test and robustness test
- 【Zeele_Tech】ROS/ROS 2介绍
猜你喜欢

Apachecon Asia 2022 speech collection begins!

A comprehensive analysis of the application of histogram

Rpcx source code learning - server side

Huawei cloud hosting experience: your software storage expert

sql server 2008使用over(PARTITION BY..ORDER BY.. ) 显示有语法错误

智能名片小程序创建名片页功能实现关键代码
![[知识图谱] Tushare数据获取和展示(1/*)](/img/c7/52fefae0cb0e8a7a2a22854521b880.png)
[知识图谱] Tushare数据获取和展示(1/*)

解决 idea web项目没有小蓝点的问题
![[langage C] opération de fichier d'analyse approfondie [niveau avancé examen spécial]](/img/49/2e1554780cd67ba336c051d08e1e1a.png)
[langage C] opération de fichier d'analyse approfondie [niveau avancé examen spécial]

I use ehcache to improve the query performance by 100 times. It's really fragrant
随机推荐
js数组对象去重
Solve the problem that the idea web project does not have small blue dots
From the perspective of source code, what are the ways to create thread pool
不同品牌设备如何兼容实现互联?一文教你看懂
Redis implements optimistic lock
Introduction to Haskell monoid
MySQL advanced common functions
What do you need to know to join smart home?
诚邀报名丨首期OpenHarmony开发者成长计划分享日
MySQL basic collection
Finally, wechat scanning code login is completed. It's really fragrant..
ApacheCon Asia 2022 演讲征集开始了!
OTS parsing error: invalid version tag solution
Public testing, exclusive, penetration testing, picking up ragged tips
How to use the drawing board to draw the structure diagram easily?
想要加盟智能家居,你需要了解些什么?
Click, walk and move of characters in 3D sandbox game
Fixturlaser centering instrument maintenance go / nxa Pro / eco / Evo series
终极套娃 2.0|云原生 PaaS 平台的可观测性实践分享
解决Svelte项目使用pnpm后Prettier无效问题