C#中的HelpProvider控件
HelpProvider控件可以挂起控件,显示帮助主题。
1.SetShowHelp()方法:设置指定控件是否显示帮助信息;
2.HelpNamespace()方法:设置帮助文件;
3.SetHelpKeyword()方法:为帮助文件设置关键字;
4.SetHelpNavigator()方法:设置显示帮助中的元素;
5.SetHelpString()方法:将帮助信息的文本字符串关联到控件上。
TestHelpProvider:
view plaincopy to clipboardprint?
1. using System;
2. using System.Collections.Generic;
3. using System.ComponentModel;
4. using System.Data;
5. using System.Drawing;
6. using System.Text;
7. using System.Windows.Forms;
8.
9. namespace TestHelpProvider
10. {
11. public partial class Form1 : Form
12. {
13. public Form1()
14. {
15. InitializeComponent();
16. }
17.
18. private void Form1_Load(object sender, EventArgs e)
19. {
20. //将帮助信息的文本字符串关联到控件上,在相应控件上按下F1键时显示
21. helpProvider1.SetHelpString(textBox1, "Enter an age that is less than 65.");
22. helpProvider1.SetHelpString(textBox2, "Enter a 5 digit post code.");
23. }
24. }
}