在C#Windows应用程序中的哪里指定主题ID [英] Where to specify topic id in c# windows application

查看:102
本文介绍了在C#Windows应用程序中的哪里指定主题ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是C#Windows应用程序的新手.我想使用帮助提供程序从Microsoft Visual Studio 2010 for Windows应用程序的工具栏中添加自定义帮助文件.

I am new to C# windows application.I would like to add custom help file using help provider from the toolbar in Microsoft visual studio 2010 for windows application.

我可以添加我的帮助文件,并且工作正常.我想要上下文相关的帮助,并且在Help.ShowHelp()下可以正常工作.在属性窗口中,我们有一个HelpNavigator属性,其中具有诸如.Topic.TopicId.AssociateIndex.TableOfContents.Index.Find之类的选项.我选择了.TopicId,但我想知道在哪里指定主题ID.我有两个问题

I can add my help file and that is working fine. I'd like to context-sensitive help and that is working fine with Help.ShowHelp(). In the properties window we have a HelpNavigator property where it has options like .Topic, .TopicId, .AssociateIndex, .TableOfContents, .Index, .Find. I have chosen .TopicId but i am wondering where to specify my topic ID. I have two questions

  • 是否可以通过在应用程序的.cs文件中编写代码来实现?
  • 如果是,那么帮助导航器属性的目的是什么?

推荐答案

短篇小说-不,您可以在不编写代码的情况下实现此功能(F1-Help)(但有时编码是更好的解决方案) .

Short story - no, you can achieve this (F1-Help) without writing code (but sometimes coding is a better solution).

HelpNavigator属性是一个枚举,它指定从指定控件的帮助文件中检索帮助时要使用的帮助命令(另请参见:

The HelpNavigator property is an enumeration that specifies the Help command to use when retrieving Help from the Help file for the specified control (see also: Help for controls with VB .NET).

将CHM帮助文件与您的应用程序连接并为控件提供上下文相关帮助时,学习曲线很小.

Connecting a CHM help file with your application and providing context-sensitive help for controls has a small learn curve.

下面是(代码)示例,这些示例演示了 F1 如何使用上下文相关帮助以及如何通过TopicId打开帮助查看器.

Below are (code) examples that demonstrate using context-sensitive help by F1 and how to open the help viewer by TopicId.

F1 -帮助

  1. 在表格中添加一个HelpProvider组件.这将添加属性 如.HelpKeyword.HelpNavigator.HelpString.ShowHelp. 将您的CHM文件的完整路径设置为 HelpProvider.HelpNamespace属性.
  2. 要启用表单标题区域上的帮助?按钮,请设置 以下表单属性HelpButton = True的值, MaximizeBox = FalseMinimizeBox = False.
  3. 使用上述控件属性可为 控制它何时具有焦点并按下 F1 ? 按钮被用户单击.例如,设置 button1 HelpKeyword属性设置为20010,其HelpNavigator属性设置为20010 .TopicId,如下面的屏幕截图所示.
  1. Add a HelpProvider component to the form. This will add properties like .HelpKeyword, .HelpNavigator, .HelpString, .ShowHelp. Set the full path to your CHM file to the HelpProvider.HelpNamespace property.
  2. To enable the help ? button on the form's caption area, set the values of the following form properties HelpButton = True, MaximizeBox = False, MinimizeBox = False.
  3. Use the control properties mentioned above to provide help for a control when it has focus and F1 was pressed or the ? button was clicked by the user. For example, set the button1 HelpKeyword property to 20010 and its HelpNavigator property to .TopicId as shown in the screenshot below.

...以及随后出现的帮助查看器窗口:

打开帮助查看器

以下代码用于按主题ID 10000打开帮助查看器和主题:

Following code is used to open a Help Viewer and a topic by TopicId 10000:

private void btnTopicId_Click(object sender, EventArgs e)
{
    Help.ShowHelp(this.btnOpenHelpShowTopic, helpProvider1.HelpNamespace, HelpNavigator.TopicId, @"10000");
}

这篇关于在C#Windows应用程序中的哪里指定主题ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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