/// <summary> /// Handles the help event for any bound controls. /// </summary> private void OnControlHelp(object sender, HelpEventArgs hevent) { Control ctl = (Control)sender; string helpString = GetHelpString(ctl); string keyword = GetHelpKeyword(ctl); HelpNavigator navigator = GetHelpNavigator(ctl); if (!GetShowHelp(ctl) || hevent == null) { return; } if (Control.MouseButtons != MouseButtons.None && !string.IsNullOrEmpty(helpString)) { Debug.WriteLineIf(Help.WindowsFormsHelpTrace.TraceVerbose, "HelpProvider:: Mouse down w/ helpstring"); Help.ShowPopup(ctl, helpString, hevent.MousePos); hevent.Handled = true; return; } // If we have a help file, and help keyword we try F1 help next if (HelpNamespace != null) { Debug.WriteLineIf(Help.WindowsFormsHelpTrace.TraceVerbose, "HelpProvider:: F1 help"); if (!string.IsNullOrEmpty(keyword)) { Help.ShowHelp(ctl, HelpNamespace, navigator, keyword); } else { Help.ShowHelp(ctl, HelpNamespace, navigator); } hevent.Handled = true; return; } // So at this point we don't have a help keyword, so try to display // the whats this help if (!string.IsNullOrEmpty(helpString)) { Debug.WriteLineIf(Help.WindowsFormsHelpTrace.TraceVerbose, "HelpProvider:: back to helpstring"); Help.ShowPopup(ctl, helpString, hevent.MousePos); hevent.Handled = true; return; } }
private void OnControlHelp(object sender, HelpEventArgs hevent) { Control ctl = (Control)sender; string helpString = this.GetHelpString(ctl); string helpKeyword = this.GetHelpKeyword(ctl); HelpNavigator helpNavigator = this.GetHelpNavigator(ctl); if (this.GetShowHelp(ctl)) { if (((Control.MouseButtons != MouseButtons.None) && (helpString != null)) && (helpString.Length > 0)) { Help.ShowPopup(ctl, helpString, hevent.MousePos); hevent.Handled = true; } if (!hevent.Handled && (this.helpNamespace != null)) { if ((helpKeyword != null) && (helpKeyword.Length > 0)) { Help.ShowHelp(ctl, this.helpNamespace, helpNavigator, helpKeyword); hevent.Handled = true; } if (!hevent.Handled) { Help.ShowHelp(ctl, this.helpNamespace, helpNavigator); hevent.Handled = true; } } if ((!hevent.Handled && (helpString != null)) && (helpString.Length > 0)) { Help.ShowPopup(ctl, helpString, hevent.MousePos); hevent.Handled = true; } if (!hevent.Handled && (this.helpNamespace != null)) { Help.ShowHelp(ctl, this.helpNamespace); hevent.Handled = true; } } }
/// <include file='doc\HelpProvider.uex' path='docs/doc[@for="HelpProvider.OnControlHelp"]/*' /> /// <devdoc> /// Handles the help event for any bound controls. /// </devdoc> /// <internalonly/> private void OnControlHelp(object sender, HelpEventArgs hevent) { Control ctl = (Control)sender; string helpString = GetHelpString(ctl); string keyword = GetHelpKeyword(ctl); HelpNavigator navigator = GetHelpNavigator(ctl); bool show = GetShowHelp(ctl); if (!show) { return; } // If the mouse was down, we first try whats this help // if (Control.MouseButtons != MouseButtons.None && helpString != null) { Debug.WriteLineIf(Help.WindowsFormsHelpTrace.TraceVerbose, "HelpProvider:: Mouse down w/ helpstring"); if (helpString.Length > 0) { Help.ShowPopup(ctl, helpString, hevent.MousePos); hevent.Handled = true; } } // If we have a help file, and help keyword we try F1 help next // if (!hevent.Handled && helpNamespace != null) { Debug.WriteLineIf(Help.WindowsFormsHelpTrace.TraceVerbose, "HelpProvider:: F1 help"); if (keyword != null) { if (keyword.Length > 0) { Help.ShowHelp(ctl, helpNamespace, navigator, keyword); hevent.Handled = true; } } if (!hevent.Handled) { Help.ShowHelp(ctl, helpNamespace, navigator); hevent.Handled = true; } } // So at this point we don't have a help keyword, so try to display // the whats this help // if (!hevent.Handled && helpString != null) { Debug.WriteLineIf(Help.WindowsFormsHelpTrace.TraceVerbose, "HelpProvider:: back to helpstring"); if (helpString.Length > 0) { Help.ShowPopup(ctl, helpString, hevent.MousePos); hevent.Handled = true; } } // As a last resort, just popup the contents page of the help file... // if (!hevent.Handled && helpNamespace != null) { Debug.WriteLineIf(Help.WindowsFormsHelpTrace.TraceVerbose, "HelpProvider:: contents"); Help.ShowHelp(ctl, helpNamespace); hevent.Handled = true; } }