Form1.cs 1001 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace WindowsFormsHelpProvider
  11. {
  12. public partial class Form1 : Form
  13. {
  14. public Form1()
  15. {
  16. InitializeComponent();
  17. }
  18. private void Form1_Load(object sender, EventArgs e)
  19. {
  20. //获取htm帮助文件的位置
  21. string strPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0,
  22. Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
  23. strPath += @"\helpPage.htm";
  24. //设置helpProvider1的HelpNamespace属性为帮助文件的路径
  25. helpProvider1.HelpNamespace = strPath;
  26. MessageBox.Show(strPath);
  27. //通过SetShowHelp设置是否显示帮助信息
  28. helpProvider1.SetShowHelp(this, true);
  29. }
  30. }
  31. }