使用F1帮助(CHM格式)使用WPF [英] Using F1 Help (CHM format) With WPF
问题描述
我一直工作在一个WPF应用程序一段时间,时间已经到了CHM格式的帮助文档附加到它。
I've been working on a WPF application for a while, and the time has come to attach the CHM format help document to it.
但是,唉! HelpProvider,显示Winforms中的CHM文件的标准方式,已经奇迹般地消失了,并在WPF中没有对应。我一直在试图使用WindowsFormsHost来产生一个新的控制,其实我可以显示帮助,但本质上它只是抓住整个用户界面的控制权。
But alas! HelpProvider, the standard way to show CHM files in Winforms, has magically vanished and has no counterpart in WPF. I've been trying to use WindowsFormsHost to spawn a new control so I can actually display the help, but essentially it just grabs control of the entire UI.
多一点细节:我已经得到了我想要,点击后打开CHM文件的菜单项。
A little more detail: I've got a menu item that I want to, when clicked, open up the CHM file.
首先,我成立了WindowsFormsHost ...
First I set up the WindowsFormsHost...
host = new System.Windows.Forms.Integration.WindowsFormsHost();
helpForm = new System.Windows.Forms.Control();
host.Child = helpForm;
host.Visibility = System.Windows.Visibility.Hidden;
this.grid1.Children.Add(host);
hp = new System.Windows.Forms.HelpProvider();
hp.HelpNamespace = "Somehelpfile.chm";
hp.SetHelpNavigator(helpForm, System.Windows.Forms.HelpNavigator.TableOfContents);
然后我说,瞧,彰显自己。
And then I say, voila, reveal yourself.
private void Help_Click(object sender, RoutedEventArgs e)
{
host.Visibility = Visibility.Visible;
helpForm.Show();
hp.SetShowHelp(helpForm, true);
}
我真的不知道在哪里,从这里着手。当我展示helpForm,它掩盖了/重写现有的用户界面和我得到的是没有帮助文件灰色,空WPF窗口。
I'm not really sure of where to proceed from here. When I show the helpForm, it obscures / overrides the existing UI and all I get is a gray, empty WPF window with no help file.
任何考生?
推荐答案
叫我疯了,但你能不能只是做:
Call me crazy, but couldn't you just do:
System.Diagnostics.Process.Start(@"C:\path-to-chm-file.chm");
这篇关于使用F1帮助(CHM格式)使用WPF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!