开发者

connect a help file to application

I want 开发者_如何学Pythonto 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:

  • How to create F1 help in windowsforms using c#
  • How to open CHM file on specified node TOC (.NET)


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

  • HTML Workshop
  • The Help class
  • The HelpProvider class
  • The HelpButtonClicked event
  • The HelpRequested event
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜