Click here to Skip to main content
Click here to Skip to main content

Tagged as

HelpButton: A Button Linked to a Topic of a chm Help File

, 8 Mar 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
When clicked, this button shows the application help file and displays its topic page.

Introduction

A few months ago, my company asked me to add a help file to our application. And of course, they wanted the different sections to be easily reached by the user.

To reach the different sections from the main application, I thought that the classical question mark inside the title window bar (Form.HelpButton) would be enough but they wanted something easier for the real newbie. They told me that first clicking the help button, then clicking the control was not intuitive enough Frown | :( ..

So I designed a very simple button: clicking that button would just display a topic from the help file. Nothing complicated there, but everybody was happy with that and it seems that the customers feedbacks were quite good as well.


screen_shot.JPG

So I thought maybe some of you could be interested even though there is nothing complicated there.

To make the help file, I used HTML Help Workshop. I created several topics with their IDs so I could reach them from code. The aim of this article is not to explain how to create help files, I will suppose that you already have one.

Using the Code

After referencing the Help.dll assembly, all you need is to initialize the chm file path (will be the same for every buttons):
Help.HelpButton.HelpFile = Application.StartupPath + "\\sample.chm";

Drop as many HelpButtons as you want inside your forms, and for each button set the Value property to the topic ID you want.

If you prefer to directly reference an HTML page or any of the HelpNavigator values, you may use the Style property of the button.

The last useful property is BigSize: you can choose whether you want a small (16x16) or large (32x32) icon for the question mark.

I hope some of you will find this control useful.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

Comments and Discussions

 
GeneralMean instead of application path we have to set the director... PinmemberDorababu7437-Mar-11 21:48 
GeneralRe: Yes. When you deploy your application, if the user selects f... PinmemberOlivier Levrey7-Mar-11 21:57 
GeneralGood one i tested your code it's working fine PinmemberDorababu7437-Mar-11 21:43 
GeneralWill that CHM will be opened if i have it any where accordin... PinmemberDorababu7437-Mar-11 21:39 
GeneralRe: "all you need is to initialize the chm file path". It means:... PinmemberOlivier Levrey7-Mar-11 21:42 
GeneralThis will search for the Help File if it is in Application d... PinmemberDorababu7437-Mar-11 17:36 
This will search for the Help File if it is in Application directory only. What if the user created a folder and place the CHM file in that folder instead of Bin
GeneralRe: This line of code was just an example. You can of course put... PinmemberOlivier Levrey7-Mar-11 21:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.141022.2 | Last Updated 8 Mar 2011
Article Copyright 2011 by Olivier Levrey
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid