怎样按F1键调用我已经编写好的CHM帮助文件,最好有源代码,用c#实现,拜托各位高手了,谢谢!!!

解决方案 »

  1.   

    js:
    function document.onkeydown()
    {
       if( event.keyCode == 捕获的键值 )
       {
          window.Open("你的CHM帮助文件名");
       }
    }
      

  2.   

    如果只是按楼上写的那样,你是无法定位到你需要定位的主题的.应用windows\system32下面的hhctrl.ocx.里面有个help.showhelp .可以帮你定位到相关的主题.
      

  3.   

    没有想到.net 里面带了该函数.请看microsoft的方法:
    http://msdn2.microsoft.com/zh-cn/library/bwb328te.aspx
      

  4.   

    注册窗体的HelpRequested事件。
    void form1_HelpRequested(object sender, System.Windows.Forms.HelpEventArgs hlpevent)
    {
    if(Control.MouseButtons == MouseButtons.None)
    {
    MessageBox.Show("aaa");
    string subtopic = null;
    if(this.ActiveControl == this.personName)
    subtopic = "personName"; // 根据当前光标所在的控件动态定位到CHM文件中的特定位置
    if(this.ActiveControl == this.personPhone)
    subtopic = "personPhone";
    Help.ShowHelp(this, "aaa.chm", "person.htm#" + subtopic);
    hlpevent.Handled = true;
    }
    }
      

  5.   

    System.Windows.Forms.HelpProvider 类 ,参考msdn,
    ms-help://MS.MSDNQTR.v80.chs/MS.MSDN.v80/MS.NETDEVFX.v20.chs/CPref17/html/T_System_Windows_Forms_HelpProvider.htm