Where to specify topic id in c# windows application

前端 未结 1 805
悲&欢浪女
悲&欢浪女 2021-01-27 02:14

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 applica

相关标签:
1条回答
  • 2021-01-27 03:10

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

    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).

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

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

    F1 - Help

    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.

    ... and the resulting help viewer window:

    Open the Help Viewer

    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");
    }
    

    0 讨论(0)
提交回复
热议问题