背景關系:
我使用免費版本的 Help'n'Doc 制作了一個 chm 檔案,以便在 .Net 應用程式中使用它。必須通過單擊按鈕呼叫此幫助并在正確的幫助頁面上打開。
問題:
而不是這個(內容選項卡中的正確頁面):

我懂了:

詳情:
這是呼叫幫助的代碼:
Help.ShowHelp(Me.btnHashtagHelp, pathHelpFile, HelpNavigator.TopicId, "6")
這是 Help'N'Doc 中的頁面:

我做錯了什么?
uj5u.com熱心網友回復:
我認為這只是左側導航窗格中剩余選項卡的問題。
在編譯幫助時,我仍然嘗試了一些諸如自動同步開/關之類的事情 - 但在你的問題的背景下沒有成功。
現在我只有通過呼叫目錄來額外打開幫助視窗并僅在之后才同步到背景關系 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
uj5u.com熱心網友回復:
找到了這種奇怪行為的原因:我呼叫的 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
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/415371.html
標籤:
上一篇:如何將屬性恢復為其默認值?
