ShadowTipForm ClassCleanCode C# Libraries v1.2.03 API
Provides a tooltip-like help but with additional functionality for larger blocks of text.
Inheritance Hierarchy

OnlineSystem Object
  OnlineSystem MarshalByRefObject
    OnlineSystem.ComponentModel Component
      OnlineSystem.Windows.Forms Control
        OnlineSystem.Windows.Forms ScrollableControl
          OnlineSystem.Windows.Forms ContainerControl
            OnlineSystem.Windows.Forms Form
              CleanCode.GeneralComponents.Dialogs ShadowTipForm

Namespace: CleanCode.GeneralComponents.Dialogs
Assembly: CleanCode.GeneralComponents (in CleanCode.GeneralComponents.dll) Version: 1.2.3.0 (1.2.03)
Syntax

public class ShadowTipForm : Form
Remarks

Features:
  • The text of the message appears on a smaller solid background floating on a semi-transparent background covering the entire parent form.
  • The size of the floating window is a percentage of the parent window and the percentage decreases as the window size increases. You could reveal the dimensions of both the shadow (and hence the dialog it covers) and the floating help text by depressing the Alt key. setting a tooltip on the entire ShadowTipForm. Depress Alt a second time to remove the tooltip in case it is a distraction.
  • The floating window may be moved out of the way if it happens to be obscuring a portion of the window you want to see. Just depress the Control key to materialize a standard form border around the floating window. You may then grab the title bar as with any form and drag the window, even outside the bounds of the parent.
  • The header (HeaderText) is larger and bold.
  • The footer (FooterText) is italic and by default says ** Click to close, ** Control-drag to move.
  • The color of the tip window and the shadow window may be adjusted via the HighlightColor and ShadowColor respectively. You may also change the fonts and colors of the text by manipulating the properties of the HeaderLabel, FooterLabel, and BodyLabel components.

Since CleanCode 0.9.29.

Examples

Here is a typical usage of this class. This example uses a BulletedStringCollection helper class to convert the text to a bulleted list. No FooterText is assigned so it uses the default. To omit the footer text entirely, set it to an empty string.

ShadowTipForm shadowForm = new ShadowTipForm();

public YourFormConstructor()
{
    . . .

    // Set up ShadowTipForm title:
    shadowForm.HeaderText = "U S A G E    T I P S";

    // Set up ShadowTipForm body:
    shadowForm.BodyText = new CleanCode.Data.BulletedStringCollection()
    {
        "= Pick a Query =",
        "Use arrow keys or the mouse to navigate the query tree.",
        "",
        "= Enter Values =",
        "Use standard SQL wildcards to match multiple values.",
        "Leave a field blank to match all values."
    }.ToString();
}

protected override void OnHelpButtonClicked(System.ComponentModel.CancelEventArgs e)
{
    // use this rather than the unadorned ShowDialog to properly position the form.
    shadowForm.PositionAndShowDialog(this);
    e.Cancel = true;
}

protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
    base.OnClosing(e);
    shadowForm.Hide();
}
See Also