【发布时间】:2010-10-30 00:17:10
【问题描述】:
我已经在 WPF 应用程序上工作了一段时间,现在是时候附上 CHM 格式的帮助文档了。
但是,唉! HelpProvider 是在 Winforms 中显示 CHM 文件的标准方法,它神奇地消失了,在 WPF 中没有对应物。我一直在尝试使用 WindowsFormsHost 来生成一个新控件,以便我可以实际显示帮助,但实际上它只是控制了整个 UI。
更多细节:我有一个菜单项,我希望在单击时打开 CHM 文件。
首先我设置了 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);
然后我说,瞧,展现你自己。
private void Help_Click(object sender, RoutedEventArgs e)
{
host.Visibility = Visibility.Visible;
helpForm.Show();
hp.SetShowHelp(helpForm, true);
}
我不确定从这里开始。当我显示 helpForm 时,它会遮盖/覆盖现有的 UI,我得到的只是一个灰色的空 WPF 窗口,没有帮助文件。
有接受者吗?
【问题讨论】:
-
这能回答你的问题吗? Integrating help in a WPF application
标签: c# wpf winforms interop chm