Integrating “Help” into WinForms Application

2019-02-02 14:03发布

问题:

I am working on a Visual Studio we need to integrate help menus into it. I would like to do this in the canonical Windows fashion but am not very experienced with the .NET framework in these respects. Searching Google and SO hasn't yielded much because most of the results are people asking for help, not help with "help." Meta-help, if you will.

From the research that I've done, .chm files seem to be the way to go. How are these files generated? Is there an integrated tool in VS?

Once I have the files, how do I get the data out of them? Do I just want to launch them in a separate process? Show an additional form and load the help file into it?

Additionally, where do I store them? And how do I tell my application to look there? I've found this question regarding multiple locales, which will be useful later but that still feels like it is a long ways away.

回答1:

You are looking for something called the Help Provider. It's a form component. It allows you to respond to F1 calls on forms or form controls and map that to a section in a help file.

http://msdn.microsoft.com/en-us/library/system.windows.forms.helpprovider.aspx

http://www.dotnetspider.com/resources/24241-F-Help-Provider.aspx

http://netpl.blogspot.com/2007/07/context-help-made-easy-revisited.html

CHM files can be made with a number of free tools. Google "Free CHM Editors" or something similar. There isn't anything integrated with VS by default.

You don't get the data out of them. What happens is when you wire a control to the help provider, you provide a path to the section in the CHM that is relevant. It will then load a CHM viewer and show the relevant section.