Go homepage(回首页) Upload pictures (上传图片) Write articles (发文字帖)
The author:(作者)qqpublished in(发表于) 2014/7/11 9:29:38 在C#中使用帮助文件
在C#中使用帮助文件示例在C#中使用帮助文件本示例中,当程序运行时,单击【启动帮助文件】按钮,调用帮助文件。程序主要代码如下:private void button1_Click(object sender, EventArgs e){string reportPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0,Application.StartupPath.LastIndexOf("")).LastIndexOf(""));reportPath += @"sl25MRMONEYHELP.HLP";System.Diagnostics.Process.Start(reportPath);}完整程序代码如下:★ ★★★★frmHelpWorkshop.cs窗体代码文件完整程序代码★★★★★using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace _5_01{public partial class frmHelpWorkshop : Form{public frmHelpWorkshop(){InitializeComponent();}private void button1_Click(object sender, EventArgs e){string reportPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0,Application.StartupPath.LastIndexOf("")).LastIndexOf(""));reportPath += @"MRMONEYHELP.HLP";System.Diagnostics.Process.Start(reportPath);}private void frmHelpWorkshop_Load(object sender, EventArgs e){}}}★ ★★★★frmHelpWorkshop.Designer.cs窗体设计文件完整程序代码★★★★★namespace _5_01{partial class frmHelpWorkshop{/// /// 必需的设计器变量。/// private System.ComponentModel.IContainer components = null;/// /// 清理所有正在使用的资源。/// /// 如果应释放托管资源,为 true;否则为 false。protected override void Dispose(bool disposing){if (disposing && (components != null)){components.Dispose();}base.Dispose(disposing);}#region Windows 窗体设计器生成的代码/// /// 设计器支持所需的方法 - 不要/// 使用代码编辑器修改此方法的内容。/// private void InitializeComponent(){this.helpProvider1 = new System.Windows.Forms.HelpProvider();this.button1 = new System.Windows.Forms.Button();this.SuspendLayout();//// helpProvider1//this.helpProvider1.HelpNamespace = "D:张宏宇C#开发mingrisoftmingrisoftsl251MRMONEYHELP.HLP";//// button1//this.button1.Location = new System.Drawing.Point(103, 37);this.button1.Name = "button1";this.button1.Size = new System.Drawing.Size(87, 23);this.button1.TabIndex = 0;this.button1.Text = "启动帮助文件";this.button1.UseVisualStyleBackColor = true;this.button1.Click += new System.EventHandler(this.button1_Click);//// frmHelpWorkshop//this.ClientSize = new System.Drawing.Size(292, 126);this.Controls.Add(this.button1);this.Name = "frmHelpWorkshop";this.Load += new System.EventHandler(this.frmHelpWorkshop_Load);this.ResumeLayout(false);}#endregionprivate System.Windows.Forms.HelpProvider helpProvider1;private System.Windows.Forms.Button button1;}}
赞