.Net 项目中的 CHM 文件:无法正确访问主题 ID
CHM File in .Net project: can't reach the topic Id correctly
上下文:
我用免费版的 Help'n'Doc 创建了一个 chm 文件,以便在 .Net 应用程序中使用它。
必须通过单击按钮调用此帮助并在正确的帮助页面上打开。
问题:
而不是这个(目录选项卡中的正确页面):
我明白了:
详情:
调用帮助的代码如下:
Help.ShowHelp(Me.btnHashtagHelp, pathHelpFile, HelpNavigator.TopicId, "6")
这是 Help'N'Doc 中的页面:
我做错了什么?
我认为这只是左侧导航窗格中剩余选项卡的问题。
我在编译帮助时仍然尝试了一些类似自动同步的东西 on/off - 但在你的问题的上下文中没有成功。
现在我只想打开帮助window另外调用table内容,然后才同步到上下文ID(见下面的代码)。
双重操作可能不会被程序的用户注意到。
我不建议切换到 Microsoft Help2 以获得应用程序帮助。
Private Sub btnOpenHelpContextId02_Click(sender As Object, e As EventArgs) Handles btnOpenHelpContextId02.Click
Dim strContextID As String
strContextID = "20010"
' --- Open help file - Table of contents (next line inserted only to reset navigation pane to TOC (fix tab issue))
Help.ShowHelp(Me.btnOpenHelpContextId02, HelpProvider1.HelpNamespace, HelpNavigator.TableOfContents)
''--- Show CHM contents tab and a special topic by TopicID -----
Help.ShowHelp(Me.btnOpenHelpContextId02, HelpProvider1.HelpNamespace, HelpNavigator.TopicId, strContextID)
End Sub
找到了这种奇怪行为的原因:我调用的chm文件不是本地的,而是存储在专业的专用网络上。
为了解决这个问题,我将文件复制到我创建的本地路径中。
这是我管理 chm 文件从“非本地”到“本地”的代码
Private Sub HelpFileManagement()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' Manage the Help File Storage '''
''' 1) Check if the local folder FOLDER1 "C:\Users\USERNAME\Documents\MyAppName" exist. If not, the folder is created
''' 2) Check if there is a MyAppName-help.chm in FOLDER1 . If not, the file is copied from the network folder to FOLDER1
''' 3) If there is already a file, check last modification date between the local file and the network file
'''
Dim strHelpFolder As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\MyAppName\"
Dim dirHelpFolder As DirectoryInfo
Dim strHelpFileName As String = "MyAppName-help.chm"
Dim strHelpSourceFile As String = System.IO.Path.Combine(Application.StartupPath, "MyAppName-help.chm")
Dim dateSourceHelpFile As DateTime
Dim dateCurrentHelpFile As DateTime
Dim strMsgException As String = "Problème dans la gestion du fichier d'aide." & vbCrLf & strMsgErrorTellYourAdmin
Try
'1)
If Directory.Exists(strHelpFolder) = False Then
dirHelpFolder = Directory.CreateDirectory(strHelpFolder)
End If
strPathHelp = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\Dumbow\"
strPathHelpFile = System.IO.Path.Combine(strPathHelp, "Dumbow2-help.chm")
'2)
If File.Exists(System.IO.Path.Combine(strHelpFolder, strHelpFileName)) = False Then
File.Copy(strHelpSourceFile, System.IO.Path.Combine(strHelpFolder, strHelpFileName))
Else
'3)
dateSourceHelpFile = File.GetLastWriteTime(strHelpSourceFile)
dateCurrentHelpFile = File.GetLastWriteTime(System.IO.Path.Combine(strHelpFolder, strHelpFileName))
If dateSourceHelpFile <> dateCurrentHelpFile Then
File.Copy(strHelpSourceFile, System.IO.Path.Combine(strHelpFolder, strHelpFileName), True)
End If
End If
Catch ex As Exception
MsgBox(strMsgException & vbCrLf & ex.Message, MsgBoxStyle.Information, strMsgBoxGeneralErrorTitle)
Exit Try
End Try
End Sub
上下文:
我用免费版的 Help'n'Doc 创建了一个 chm 文件,以便在 .Net 应用程序中使用它。 必须通过单击按钮调用此帮助并在正确的帮助页面上打开。
问题:
而不是这个(目录选项卡中的正确页面):
我明白了:
详情:
调用帮助的代码如下:
Help.ShowHelp(Me.btnHashtagHelp, pathHelpFile, HelpNavigator.TopicId, "6")
这是 Help'N'Doc 中的页面:
我做错了什么?
我认为这只是左侧导航窗格中剩余选项卡的问题。
我在编译帮助时仍然尝试了一些类似自动同步的东西 on/off - 但在你的问题的上下文中没有成功。
现在我只想打开帮助window另外调用table内容,然后才同步到上下文ID(见下面的代码)。
双重操作可能不会被程序的用户注意到。
我不建议切换到 Microsoft Help2 以获得应用程序帮助。
Private Sub btnOpenHelpContextId02_Click(sender As Object, e As EventArgs) Handles btnOpenHelpContextId02.Click
Dim strContextID As String
strContextID = "20010"
' --- Open help file - Table of contents (next line inserted only to reset navigation pane to TOC (fix tab issue))
Help.ShowHelp(Me.btnOpenHelpContextId02, HelpProvider1.HelpNamespace, HelpNavigator.TableOfContents)
''--- Show CHM contents tab and a special topic by TopicID -----
Help.ShowHelp(Me.btnOpenHelpContextId02, HelpProvider1.HelpNamespace, HelpNavigator.TopicId, strContextID)
End Sub
找到了这种奇怪行为的原因:我调用的chm文件不是本地的,而是存储在专业的专用网络上。 为了解决这个问题,我将文件复制到我创建的本地路径中。
这是我管理 chm 文件从“非本地”到“本地”的代码
Private Sub HelpFileManagement()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' Manage the Help File Storage '''
''' 1) Check if the local folder FOLDER1 "C:\Users\USERNAME\Documents\MyAppName" exist. If not, the folder is created
''' 2) Check if there is a MyAppName-help.chm in FOLDER1 . If not, the file is copied from the network folder to FOLDER1
''' 3) If there is already a file, check last modification date between the local file and the network file
'''
Dim strHelpFolder As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\MyAppName\"
Dim dirHelpFolder As DirectoryInfo
Dim strHelpFileName As String = "MyAppName-help.chm"
Dim strHelpSourceFile As String = System.IO.Path.Combine(Application.StartupPath, "MyAppName-help.chm")
Dim dateSourceHelpFile As DateTime
Dim dateCurrentHelpFile As DateTime
Dim strMsgException As String = "Problème dans la gestion du fichier d'aide." & vbCrLf & strMsgErrorTellYourAdmin
Try
'1)
If Directory.Exists(strHelpFolder) = False Then
dirHelpFolder = Directory.CreateDirectory(strHelpFolder)
End If
strPathHelp = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\Dumbow\"
strPathHelpFile = System.IO.Path.Combine(strPathHelp, "Dumbow2-help.chm")
'2)
If File.Exists(System.IO.Path.Combine(strHelpFolder, strHelpFileName)) = False Then
File.Copy(strHelpSourceFile, System.IO.Path.Combine(strHelpFolder, strHelpFileName))
Else
'3)
dateSourceHelpFile = File.GetLastWriteTime(strHelpSourceFile)
dateCurrentHelpFile = File.GetLastWriteTime(System.IO.Path.Combine(strHelpFolder, strHelpFileName))
If dateSourceHelpFile <> dateCurrentHelpFile Then
File.Copy(strHelpSourceFile, System.IO.Path.Combine(strHelpFolder, strHelpFileName), True)
End If
End If
Catch ex As Exception
MsgBox(strMsgException & vbCrLf & ex.Message, MsgBoxStyle.Information, strMsgBoxGeneralErrorTitle)
Exit Try
End Try
End Sub