Sunday, February 10, 2008

HTML Help for Windows Forms

I briefly tried using HTML Help Workshop to provide context sensitive help for a Windows Forms application but had no luck. Recently I've gotten a chance to take another look at it. So here are a few tips:


  1. Create a separate HTML page for each topic.

    • Another way to put this is to create a separate HTML page for everything that might require context sensitive help. E.g., every user interface widget (or at least those you want to provide with context sensitive help).
    • Use whatever HTML editor you prefer - I like the Visual Studio 2005 designer so I use that.

  2. Create an HTML Help project (.hhp) in the directory containing the HTML files.
  3. Manually add all of the HTML files to the project.
  4. Don't bother with automatically generating a table of contents since all sections within a file will link to the top of the file.
  5. Manually create a Table of Contents from the "Contents" tab.

    • There are 2 types of entries; headings and pages.
    • Heading entries are represented by a book and can contain child entries.
    • If you want the heading entry to display a topic (=HTML page) when clicked you have to edit it.
    • Edit an entry by selecting it then clicking the pencil button to open the "Table of Contents Entry" editor.
    • Under "Files/URLs and their information types" add the topic (e.g., MyFirstTopic.html) to the list.
    • Do the same thing for pages since you usually want a topic to display when a page is clicked from the TOC.

  6. Use relative Files/URLs so that moving the project and its html files to a different directory won't prevent compilation.
  7. Compile the project then click the glasses icon to view the .chm file.

Once the HTML help project is done compiling a new .CHM file can be automated in a post-build event that uses the HHC.exe in the program files directory for HTML Help Workshop.

No comments :

Post a Comment