c# 操作CHM文件
来源:互联网 发布:大数据分析报告 编辑:程序博客网 时间:2024/05/29 08:00
HelpNavigator 枚举
- .NET Framework 4.5
- .NET Framework 3.5
- .NET Framework 3.0
- .NET Framework 2.0
指定常数来指示要显示的帮助文件元素。
程序集: System.Windows.Forms(在 System.Windows.Forms.dll 中)
public enum HelpNavigator
Help 和HelpProvider 类使用此枚举提供对帮助文件中特定元素的访问。例如,当用于提供 F1 帮助的 HelpProvider 组件时,可指定TopicId 或 Topic 的值,从而打开到帮助中上下文特定的主题。
下面的代码示例显示带有三个按钮的窗体,这些按钮可用于与 mspaint.chm 帮助文件进行交互。“显示帮助索引”按钮显示帮助文件的“索引”选项卡。“显示帮助”按钮根据“帮助导航器”列表中选择的值显示帮助文件的内容。“显示关键字”按钮根据“关键字”文本框中指定的关键字显示帮助文件的内容。
例如,若要按索引值显示 Ovals 帮助页,请在“帮助导航器”下拉列表中选择HelpNavigator.KeywordIndex 值,在“参数”文本框中键入“ovals”,然后单击“显示帮助”按钮。若要按关键字显示“使用画笔绘图”帮助主题,请在“关键字”文本框中键入“mspaint.chm::/paint_brush.htm”,然后单击“显示关键字”按钮。
该示例使用 ShowHelp 方法显示不同的“帮助”选项卡和“帮助”主题,并用ShowHelpIndex 方法显示“帮助”索引。
using System;using System.Drawing;using System.ComponentModel;using System.Windows.Forms;public class Form1 : System.Windows.Forms.Form{ private const string helpfile = "mspaint.chm"; private System.Windows.Forms.Button showIndex; private System.Windows.Forms.Button showHelp; private System.Windows.Forms.Label label1; private System.Windows.Forms.ComboBox navigatorCombo; private System.Windows.Forms.Button showKeyword; private System.Windows.Forms.TextBox keyword; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox parameterTextBox; [STAThread] static void Main() { Application.Run(new Form1()); } public Form1() { this.showIndex = new System.Windows.Forms.Button(); this.showHelp = new System.Windows.Forms.Button(); this.navigatorCombo = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.showKeyword = new System.Windows.Forms.Button(); this.keyword = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.parameterTextBox = new System.Windows.Forms.TextBox(); // Help Navigator Label this.label1.Location = new System.Drawing.Point(112, 64); this.label1.Size = new System.Drawing.Size(168, 16); this.label1.Text = "Help Navigator:"; // Keyword Label this.label2.Location = new System.Drawing.Point(120, 184); this.label2.Size = new System.Drawing.Size(100, 16); this.label2.Text = "Keyword:"; // Parameter Label this.label3.Location = new System.Drawing.Point(112, 120); this.label3.Size = new System.Drawing.Size(168, 16); this.label3.Text = "Parameter:"; // Show Index Button this.showIndex.Location = new System.Drawing.Point(16, 16); this.showIndex.Size = new System.Drawing.Size(264, 32); this.showIndex.TabIndex = 0; this.showIndex.Text = "Show Help Index"; this.showIndex.Click += new System.EventHandler(this.showIndex_Click); // Show Help Button this.showHelp.Location = new System.Drawing.Point(16, 80); this.showHelp.Size = new System.Drawing.Size(80, 80); this.showHelp.TabIndex = 1; this.showHelp.Text = "Show Help"; this.showHelp.Click += new System.EventHandler(this.showHelp_Click); // Show Keyword Button this.showKeyword.Location = new System.Drawing.Point(16, 192); this.showKeyword.Size = new System.Drawing.Size(88, 32); this.showKeyword.TabIndex = 4; this.showKeyword.Text = "Show Keyword"; this.showKeyword.Click += new System.EventHandler(this.showKeyword_Click); // Help Navigator ComboBox this.navigatorCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.navigatorCombo.Location = new System.Drawing.Point(112, 80); this.navigatorCombo.Size = new System.Drawing.Size(168, 21); this.navigatorCombo.TabIndex = 2; // Keyword TextBox this.keyword.Location = new System.Drawing.Point(120, 200); this.keyword.Size = new System.Drawing.Size(160, 20); this.keyword.TabIndex = 5; this.keyword.Text = ""; // Parameter TextBox this.parameterTextBox.Location = new System.Drawing.Point(112, 136); this.parameterTextBox.Size = new System.Drawing.Size(168, 20); this.parameterTextBox.TabIndex = 8; this.parameterTextBox.Text = ""; // Set up how the form should be displayed and add the controls to the form. this.ClientSize = new System.Drawing.Size(292, 266); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.parameterTextBox, this.label3, this.label2, this.keyword, this.showKeyword, this.label1, this.navigatorCombo, this.showHelp, this.showIndex}); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Text = "Help App"; // Load the various values of the HelpNavigator enumeration // into the combo box. TypeConverter converter; converter = TypeDescriptor.GetConverter(typeof(HelpNavigator)); foreach(object value in converter.GetStandardValues()) { navigatorCombo.Items.Add(value); } } private void showIndex_Click(object sender, System.EventArgs e) { // Display the index for the help file. Help.ShowHelpIndex(this, helpfile); } private void showHelp_Click(object sender, System.EventArgs e) { // Display Help using the Help navigator enumeration // that is selected in the combo box. Some enumeration // values make use of an extra parameter, which can // be passed in through the Parameter text box. HelpNavigator navigator = HelpNavigator.TableOfContents; if (navigatorCombo.SelectedItem != null) { navigator = (HelpNavigator)navigatorCombo.SelectedItem; } Help.ShowHelp(this, helpfile, navigator, parameterTextBox.Text); } private void showKeyword_Click(object sender, System.EventArgs e) { // Display help using the provided keyword. Help.ShowHelp(this, helpfile, keyword.Text); }}
.NET Framework
受以下版本支持:4、3.5、3.0、2.0、1.1、1.0.NET Framework Client Profile
受以下版本支持:4、3.5 SP1Windows 7, Windows Vista SP1 或更高版本, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008(不支持服务器核心), Windows Server 2008 R2(支持 SP1 或更高版本的服务器核心), Windows Server 2003 SP2
.NET Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。参考
- c# 操作CHM文件
- C#生成CHM文件
- C# 生成CHM文件
- 手把手教你C#生成CHM文件
- C#生成CHM文件(中级篇)
- 添加CHM文件到项目 C#
- Html文件转CHM文件类--------用C#实现将html文件转换为chm文件
- Html文件转CHM文件类--------用C#实现将html文件转换为chm文件
- 解决打开CHM文件,出现"取消操作“的怪现象
- 解决打开CHM文件,出现"取消操作“的怪现象
- 用C#实现将HTML文件转换为CHM文件(转) - C#探索者 - 博客园
- C# 引用chm帮助文件
- C#中的文件操作
- C# 文件操作
- C# 文件操作
- c#文件操作
- C#中的文件操作
- C#文件操作
- python串口编程整理(更新完)
- 谈”句柄泄漏“
- MFC对话框背景色的设置
- BitmapImage 资源释放
- notoriously 众所周知地;声名狼藉地;恶名昭彰地
- c# 操作CHM文件
- 64位 TortoiseSVN 不显示图标
- iPhone开发基础教程笔记(三)--第四章 更丰富的用户界面
- 文本文件与二进制文件区别
- Spring单例与多线程的理解
- php时间显示
- 运用xlib进行事件响应(X11 API)的小例子
- 如何高效准确的翻译专业(电子通信类)文档
- sloppy 草率的 粗心的