Easily add context sensitive help to your Windows Forms application

by Geert 30. December 2008 09:41

Some time ago, I was looking for a simply component to let me easily implement context sensitive help without requiring me to fully rewrite the application (dropping the help components on each form, set the help context of all the controls, etc). After a short search, I found this article on CodeProject by Tom Clement. The article is great, but not what I was looking for. I still had to derive every form in my application (which contains a lot of forms) from a custom form class that contains the help component. But hey, it's better than the alternative (adding all help components manually to all forms).

However, when I searched the comments, I found a link to a great new article by Wiktor Zychla. He made some great improvements by creating a Help Component that you can simply drop onto your main form. Then, everything happens as it is magic. That was exactly what I was looking for!

After working with the control for a while, I noticed that I wanted some improvements. What I changed can be found below:

(+) Added combobox to editor form so a help file can be selected from a list
(*) Translated UI to English
(*) Help files must be located in a subdirectory Help (constant defined in Constants.cs)
(x) The files are now opened in read-only mode so this component will also work on Vista without elevation

You can download the updated source here: CatenaLogic.Help.zip (24.10 kb) [Downloads: 903]

Even though the namespace has changed to CatenaLogic.Help, all credits still go to Tom Clement and Wiktor Zychla. I just made some small improvements.

This is how to use the control:

  1. Recompile the library from the provided source
  2. Put the HelpComponent on the main form of your application
  3. Run the application with helpprovider commandline parameter
  4. Use Ctrl+F1 to map help topics to controls. Remember about the hierarchy - you do not have to provide topics for all controls, it is sufficient to provide the topic for a container control and all its child controls inherit the mapping.
  5. Remember to provide a help file name (must be a *.chm file located beside the application main executable)
  6. When the mapping is complete, include the help.mapping file stored beside the application main executable as an embedded resource in one of assemblies
  7. Remove the help.mapping file located beside the application main executable
  8. Rebuild the application

kick it on DotNetKicks.com

Tags:

C#

Comments (2) -

Dan Mattsson
Dan Mattsson Sweden
1/24/2009 10:31:46 PM #

Geert, thanks for the improvements. However, there's a file called EULA.txt in the archive which contains rather restrictive phrases like "5. You are not allowed to distribute this software without written permission by CatenaLogic." Although it's obviously an EULA the status of the code is a bit ambigouos, a problem for me as we would like to use it in a commercial application.

The original code was published with Code Project Open License (http://www.codeproject.com/info/cpol10.aspx) which is very permissive. May I suggest that this code too is published under these conditions?

Geert van Horrik
Geert van Horrik Netherlands
1/27/2009 9:25:09 AM #

Hi Dan,

You are absolutely right. I have updated the license (removed the EULA and added the CPOL).

Best regards,

Geert

Pingbacks and trackbacks (1)+

Comments are closed

About the Author

Geert van Horrik is an independent freelance software developer since January 1st, 2007. Since then he was been working on several projects from C++ to C# (WPF, Silverlight, ASP.NET, etc). Currently he loves to write his software using WPF (or Silverlight if WPF isn't an option).

Lately, Geert is spending a lot of time on Catel, a free open-source MVVM Framework for WPF and Silverlight. Actually, it's more than "just" an MVVM Framework, it's a complete application library!