首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

WPF 弹出 popup 里面的 TextBox 无法输入汉字 修复在 Popup 输入法不跟随在 WinForms 弹出的 WPF 的 TextBox 无法输入问题

解决的方法是让输入法知道控件的句柄,这需要一个 win32 的 dll ,传说中的 User32.dll ,这个dll有SetFocus这个方法,请通过下面的代码在Popup打开时调用。...[DllImport("User32.dll")] public static extern IntPtr SetFocus(IntPtr hWnd); IntPtr GetHwnd(Popup popup...sender, RoutedEventArgs e) { ThePopup.IsOpen = true; IntPtr handle = GetHwnd(ThePopup); SetFocus...Popup 里的 TextBox 输入可能出现输入法未跟随编辑框,这时需要调用 Win32 的方法 [DllImport("User32.dll")] public static extern IntPtr SetFocus...RoutedEventArgs e) { // WPF BUG Fix:TextBox 在 Popup 中,IME 备选框不跟随 Win32.SetFocus

2.4K20
领券