In order to associate topics from your Help file with form controls, you must specify the source Help file.
You can do this from the C1DynamicHelp Tasks menu by setting the HelpSource property to any *.chm file or NetHelp *.htm file (use the default.htm or the file name that was used as the base URL for the NetHelp target.). In this example, we will use the C1Sample.chm installed with DynamicHelp for WinForms, by default.
Once a source Help file is specified, you can prepare the C1DynamicHelp control to be used in authoring mode. This step should be performed by the developer.
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
' toggle authoring mode when the user hits Ctrl+Shift+A Protected Overrides Sub OnKeyDown(ByVal e As System.Windows.Forms.KeyEventArgs) If (e.KeyCode = Keys.A And e.Control And e.Shift) Then C1DynamicHelp1.AuthoringMode = Not C1DynamicHelp1.AuthoringMode End If MyBase.OnKeyDown(e) End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
// toggle authoring mode when the user hits Ctrl+Shift+A override protected void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.A && e.Control && e.Shift) { c1DynamicHelp1.AuthoringMode = !c1DynamicHelp1.AuthoringMode; } base.OnKeyDown(e); } |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load C1DynamicHelp1.TopicMap.Refresh() End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void Form1_Load(object sender, EventArgs e) { c1DynamicHelp1.TopicMap.Refresh(); } |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing If (C1DynamicHelp1.TopicMap.HasChanges) Then Dim dr As DialogResult dr = MessageBox.Show("Would you like to save the changes you made to control/topic map?", "C1DynamicHelp Tutorial", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) If (dr = DialogResult.Yes) Then C1DynamicHelp1.TopicMap.Save() ElseIf (dr = DialogResult.Cancel) Then e.Cancel = True End If End If End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (c1DynamicHelp1.TopicMap.HasChanges) { DialogResult result = MessageBox.Show("Would you like to save the changes you made to control/topic map?", "C1DynamicHelp Tutorial", MessageBoxButtons.YesNoCancel , MessageBoxIcon.Question); if (result == DialogResult.Yes) c1DynamicHelp1.TopicMap.Save(); else if (result == DialogResult.Cancel) e.Cancel = true; } } |
No controls have topics associated with them yet. The application can now be used by a Help author to map topics to controls.