本文整理汇总了C#中System.Windows.Forms.HelpProvider.GetHelpString方法的典型用法代码示例。如果您正苦于以下问题:C# HelpProvider.GetHelpString方法的具体用法?C# HelpProvider.GetHelpString怎么用?C# HelpProvider.GetHelpString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.HelpProvider
的用法示例。
在下文中一共展示了HelpProvider.GetHelpString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Bind
public static void Bind(HelpProvider localHelpProvider, Control control)
{
IHelpProviderContext context = control.FindForm() as IHelpProviderContext;
if (context != null)
{
if (localHelpProvider.GetShowHelp(control))
{
string helpString = localHelpProvider.GetHelpString(control);
if (helpString != null)
{
context.HelpProvider.SetShowHelp(control, true);
context.HelpProvider.SetHelpString(control, helpString);
}
}
}
}
示例2: BasicPropertiesTest
public void BasicPropertiesTest ()
{
SWF.HelpProvider swfHelpProvider = new SWF.HelpProvider ();
SWF.Button swfButton = new SWF.Button ();
swfButton.Location = new SD.Point (3, 3);
swfButton.Size = new SD.Size (272, 72);
swfButton.Text = "With help";
SWF.Button swfButtonNoHelp = new SWF.Button ();
swfButtonNoHelp.Location = new SD.Point (3, 30);
swfButtonNoHelp.Size = new SD.Size (272, 72);
swfButtonNoHelp.Text = "No help";
//We have to use an event to fake the user click
swfButton.Click += new System.EventHandler (OnControlClicked);
swfHelpProvider.SetShowHelp (swfButton, true);
swfHelpProvider.SetHelpString (swfButton, "I'm showing a button tooltip.");
Form.Controls.Add (swfButton);
Form.Controls.Add (swfButtonNoHelp);
//Testing ToolTipOpenedEvent
bridge.ResetEventLists ();
swfButton.PerformClick (); //Clicking the button will fake the event!
StructureChangedEventTuple eventTuple
= bridge.GetStructureChangedEventAt (0, StructureChangeType.ChildAdded);
Assert.IsNotNull (eventTuple, "GetAutomationEventAt (0)");
//We have the HelpProvider!
IRawElementProviderFragment helpProvider = eventTuple.provider as IRawElementProviderFragment;
Assert.IsNotNull (helpProvider, "helpProvider is null");
TestProperty (helpProvider,
AutomationElementIdentifiers.IsControlElementProperty,
true);
TestProperty (helpProvider,
AutomationElementIdentifiers.IsContentElementProperty,
false);
TestProperty (helpProvider,
AutomationElementIdentifiers.HelpTextProperty,
null);
TestProperty (helpProvider,
AutomationElementIdentifiers.LocalizedControlTypeProperty,
"tool tip");
TestProperty (helpProvider,
AutomationElementIdentifiers.ControlTypeProperty,
ControlType.ToolTip.Id);
TestProperty (helpProvider,
AutomationElementIdentifiers.LabeledByProperty,
null);
TestProperty (helpProvider,
AutomationElementIdentifiers.NameProperty,
swfHelpProvider.GetHelpString (swfButton));
TestProperty (helpProvider,
AutomationElementIdentifiers.IsKeyboardFocusableProperty,
false);
TestProperty (helpProvider,
AutomationElementIdentifiers.ClickablePointProperty,
null);
// TODO: How to allow it?
// bridge.ResetEventLists ();
//
// swfButtonNoHelp.PerformClick (); //Clicking this button will close the tooltip
//
// Assert.AreEqual (1,
// bridge.GetAutomationEventCount (InvokePatternIdentifiers.InvokedEvent),
// "AutomationElementIdentifiers.InvokedEvent");
//
// Assert.IsNotNull (bridge.GetStructureChangedEventAt (0, StructureChangeType.ChildRemoved),
// "AutomationElementIdentifiers.ChildRemoved");
}