简体   繁体   中英

connect a help file to application

I want to connect a help file(.chm) to my windows application. How do I can do this? Thanks.

Try this

string fbPath = Application.StartupPath;
string fname = "help.chm";
string filename = fbPath + @"\" + fname;
FileInfo fi = new FileInfo(filename);
if (fi.Exists)
{
Help.ShowHelp(this, filename, HelpNavigator.Find, "");
}
else
{
MessageBox.Show("Help file Is in Progress.. ",MessageBoxButtons.OK, MessageBoxIcon.Information);

}

Use the Help.ShowHelp method for doing it on button presses etc:

private void button1_click(object sender, EventArgs e)
{
      string helpfile = "C:\MyHelp.chm";
      Help.ShowHelp(this, helpfile, mypage.htm);
}

and to link your help via the F1 key see this guide for a detailed explanation on how to do this:

http://www.dotnetspark.com/kb/162-open-help-file-on-f1-function-key-press.aspx

You can use Help.ShowHelp .

One example from the MSDN page:

private void Button1_Click(System.Object sender, System.EventArgs e)
    {

        Help.ShowHelp(TextBox1, "file://c:\\charmap.chm");
    }

You can also check out these SO pages:

For Winforms, the excellent Windows Forms Programming provides a very nice overview (chapter 3, implementing help). Some pointers:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM