如何使用 c# 在 windows 窗体中创建 F1 帮助

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1029316/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 12:41:33  来源:igfitidea点击:

How to create F1 help in windows forms using c#

.netwindowschm

提问by Jeff Moser

How do you create the keyboard shortcut(F1) in a windows form using c#. WinChm

如何使用 c# 在 windows 窗体中创建键盘快捷键(F1)。WinChm

回答by Jeff Moser

Add an event handler for a control's HelpRequestedevent and then use the Help.ShowHelp.

为控件的HelpRequested事件添加一个事件处理程序,然后使用Help.ShowHelp

For example,

例如,

private void button1_HelpRequested(object sender, HelpEventArgs hlpevent)
{
   Help.ShowHelp(this, "helpfile.chm", HelpNavigator.TopicId, "1234");
}

You can use different HelpNavigatoroptions to show things like the table of contents, etc.

您可以使用不同的HelpNavigator选项来显示目录等内容。

See this related questionfor more information.

有关更多信息,请参阅此相关问题