单击按钮打开“帮助文件” [英] Open Help File on button click

查看:94
本文介绍了单击按钮打开“帮助文件”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个帮助文件,并保存在我的项目目录中。

我想在按钮点击时打开帮助文件。我不知道如何设置该帮助文件的路径,以便在我的应用程序的安装文件后,我将能够在按钮单击时运行帮助文件。

如果我将帮助文件保存在我的调试文件夹中它会运行,但是如果我把它保留在其他任何地方它说无法找到路径..

请帮我在哪里保持文件以及如何设置该文件的路径,以便在进行设置并将其安装到我的PC后,单击按钮将打开帮助文件。



提前致谢。 ..

I have a help file created and i have kept in my project directory.
I want to open the help file on button click. I don't know how to set the path for that help file so that after making setup file of my application i will be able to run the Help file on button click.
If i keep the help file in my debug folder it runs but if i keep it anywhere else it says cannot find the path..
Please help me where to keep the file and how to set path to that file so that after making setup and install it in my PC, the button click should open the help file.

Thanks in advance...

推荐答案

将其保存在应用程序目录中 - 或者更好地为名为帮助的帮助文件创建一个子目录并将其粘贴在那里。 (安装程序应该能够自动为您完成)

然后,您可以通过添加\Help\MyHelpFile.ext来通过Application.StartupPath属性访问它。
Keep it in the application directory - or better create a subdirectory for help files called "Help" and stick it in there. (The installation program should be able to do that for you automatically)
You can then access it via the Application.StartupPath property by adding "\Help\MyHelpFile.ext".


你可以使用这样的东西。

You can use something like this.
Process.Start("notepad.exe", "C:\\Users\\gaurav_joshi\\My Documents\\test.txt")



假设您的帮助文件是一个简单的文本文件。< br $>


-SG







更正了格式和语法问题。

[/ Edit]


如果将它保存在应用程序的bin文件夹中,这是很好的。因此,当您安装或执行帮助文件时,它仍然保留在bin文件夹中。



您可以使用以下代码在按钮单击事件上打开文件。 />


It is good that if you keep it in the bin folder of your application. So that when you install or execute the help file remains in the bin folder itself.

you can use the below code to open the file on button click event.

private void OpenHelp()
{
    System.Diagnostics.Process.Start(Application.StartupPath + "\\NAME_HELP.chm");
}



希望它可以帮到你。


Hope it helps you.


这篇关于单击按钮打开“帮助文件”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆