显示PDF成为焦点并使用热键 [英] Display PDF Takes Focus and Eats Hot Key
问题描述
我在SO上发现的使用的代码可以通过WindowsFormsHost中的主机使用基于COM的Acrobat Reader来显示PDF.
Used code I found on SO to use the COM based Acrobat Reader to display PDF via hosting in a WindowsFormsHost.
它显示PDF格式.两个问题:
It displays the PDF fine. Two problems:
-
当我加载PDF时,控件AxAcroPDFLib.AxAcroPDF成为焦点
When I load the PDF the control AxAcroPDFLib.AxAcroPDF takes focus
我希望焦点保持在先前的
I want focus to remain on the prior
当AxAcroPDFLib.AxAcroPDF专注时,它会吃掉热键(N)
When AxAcroPDFLib.AxAcroPDF has focus it eats the Hot Key (N)
ALT键甚至不会在N下划线.即使用户选择了AxAcroPDFLib.AxAcroPDF,我也希望热键能够正常工作.
The ALT key does not even underline the N. Even if the user selects the AxAcroPDFLib.AxAcroPDF I would like the Hot Keys to work.
我了解这是WPF中的COM和Adobe,可能没有答案.如果有免费或廉价的WPF控件来查看PDF,我很乐意走这条路.这是用于商业应用程序,因此必须免费(或便宜)用于商业用途.
I understand this is COM and Adobe in WPF and there may not be an answer. If there is a free or cheap WPF control to view PDF I would be happy to go down that path. This is for a commercial application so it has to be free (or cheap) for commercial use.
<Button Click="Button_Click">_Next</Button>
<WindowsFormsHost Name="windowsFormsHost1" Margin="1" />
UserControl1 UC = new UserControl1(@"C:\temp\1000001.pdf");
this.windowsFormsHost1.Child = UC;
public UserControl1(string filename)
{
InitializeComponent();
this.axAcroPDF1.LoadFile(filename);
}
这确实显示PDF.在生产应用程序中,我根据使用的操作显示各种PDF.
This does display PDF. In the production application I display various PDFs based on used actions.
推荐答案
汉斯所说的话. Acrobat似乎正在吃键盘按键,对此我无能为力.
What Hans said. Acrobat appears to be eating key strokes and there is nothing I can do about it.
这篇关于显示PDF成为焦点并使用热键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!