Loading...
Loading...
Guide for implementing Syncfusion Windows Forms Tooltip (SfToolTip) component for displaying contextual information and hover text in Windows Forms applications. Use this skill when implementing tooltips, popup information, balloon tips, or informational popups on controls. Covers SfToolTip setup, multi-item tooltips, custom tooltip content, appearance customization, and tooltip images.
npx skill4agent add syncfusion/winforms-ui-components-skills syncfusion-winforms-tooltipSfToolTipSfToolTipSfToolTipSuperToolTipSfToolTipusing Syncfusion.Windows.Forms;
// Add SfToolTip component to form
SfToolTip sfToolTip1 = new SfToolTip();
// Set simple text tooltip
sfToolTip1.SetToolTip(this.button1, "Click to submit the form");using Syncfusion.Windows.Forms;
using Syncfusion.WinForms.Controls;
SfToolTip sfToolTip1 = new SfToolTip();
// Create ToolTipInfo with multiple items
ToolTipInfo toolTipInfo = new ToolTipInfo();
ToolTipItem item1 = new ToolTipItem();
item1.Text = "User Information";
item1.Style.Font = new Font("Arial", 10f, FontStyle.Bold);
ToolTipItem item2 = new ToolTipItem();
item2.Text = "Name: John Doe\nEmail: john@example.com";
toolTipInfo.Items.AddRange(new ToolTipItem[] { item1, item2 });
sfToolTip1.SetToolTipInfo(this.button1, toolTipInfo);SfToolTip sfToolTip1 = new SfToolTip();
ToolTipInfo toolTipInfo = new ToolTipInfo();
toolTipInfo.ToolTipStyle = ToolTipStyle.Balloon;
toolTipInfo.BeakBackColor = Color.LightSkyBlue;
ToolTipItem toolTipItem = new ToolTipItem();
toolTipItem.Text = "David Carter\nPhone: +1 919.494.1974\nEmail: david@syncfusion.com";
toolTipItem.Image = Properties.Resources.UserImage;
toolTipItem.Style.ImageSize = new Size(80, 80);
toolTipItem.Style.ImageAlignment = ToolTipImageAlignment.Left;
toolTipInfo.Items.Add(toolTipItem);
sfToolTip1.SetToolTipInfo(this.button1, toolTipInfo);ToolTipInfo toolTipInfo = new ToolTipInfo();
toolTipInfo.BorderColor = Color.DarkGray;
toolTipInfo.BorderThickness = 2;
ToolTipItem toolTipItem = new ToolTipItem();
toolTipItem.Text = "Important Information";
toolTipItem.EnableGradientBackground = true;
toolTipItem.Style.GradientBrush = new BrushInfo(
GradientStyle.Horizontal,
new Color[] { Color.LightBlue, Color.LightGreen }
);
toolTipItem.Style.Font = new Font("Arial", 10f, FontStyle.Bold);
toolTipItem.Style.ForeColor = Color.DarkBlue;
toolTipInfo.Items.Add(toolTipItem);
sfToolTip1.SetToolTipInfo(this.control, toolTipInfo);sfToolTip1.ToolTipShowing += (sender, e) =>
{
// Customize tooltip based on control state
if (e.Control is Button button && !button.Enabled)
{
e.Cancel = true; // Don't show tooltip for disabled controls
}
// Or modify appearance dynamically
if (e.Control.Tag?.ToString() == "Warning")
{
e.ToolTipInfo.Items[0].Style.BackColor = Color.LightCoral;
e.ToolTipInfo.BorderColor = Color.Red;
}
};// Show tooltip at specific location
Point location = new Point(300, 200);
sfToolTip1.Show("Processing complete!", location);
// Show tooltip at cursor position with duration
ToolTipInfo info = new ToolTipInfo();
ToolTipItem item = new ToolTipItem { Text = "Operation successful!" };
info.Items.Add(item);
sfToolTip1.Show(info);
// Hide after delay
await Task.Delay(3000);
sfToolTip1.Hide();// Create custom control (e.g., PictureBox with animated GIF)
PictureBox pictureBox = new PictureBox();
pictureBox.Image = Image.FromFile("loading.gif");
pictureBox.SizeMode = PictureBoxSizeMode.CenterImage;
pictureBox.Size = new Size(200, 100);
ToolTipInfo toolTipInfo = new ToolTipInfo();
ToolTipItem toolTipItem = new ToolTipItem();
toolTipItem.Control = pictureBox;
toolTipInfo.Items.Add(toolTipItem);
sfToolTip1.SetToolTipInfo(this.button1, toolTipInfo);| Property | Type | Description |
|---|---|---|
| int | Delay before tooltip appears (milliseconds, default: 0) |
| int | Duration tooltip remains visible (milliseconds, default: 5000) |
| bool | Enable shadow effect on tooltip |
| Property | Type | Description |
|---|---|---|
| ToolTipItemCollection | Collection of tooltip items to display |
| ToolTipStyle | Rectangle (default) or Balloon style |
| Color | Background color of balloon beak |
| Color | Border color of tooltip |
| int | Border thickness in pixels |
| int | Minimum tooltip width |
| int | Maximum tooltip width |
| RightToLeft | RTL layout support |
| Property | Type | Description |
|---|---|---|
| string | Tooltip item text content |
| Image | Image to display in item |
| ImageList | ImageList for multiple images |
| int | Index when using ImageList |
| Control | Custom control to host in item |
| bool | Show separator line after item |
| bool | Enable gradient background |
| Padding | Spacing around item content |
| ToolTipStyleInfo | Comprehensive styling options |
| Property | Type | Description |
|---|---|---|
| Color | Background color |
| Color | Text color |
| Font | Text font |
| ContentAlignment | Text alignment (MiddleLeft, etc.) |
| ToolTipImageAlignment | Image position (Left, Top, Right) |
| Size | Fixed image dimensions |
| int | Spacing between image and text |
| BrushInfo | Gradient configuration |
| Color | Separator line color |
| DashStyle | Separator line style |
| Event | Description | Use Case |
|---|---|---|
| Fires before tooltip displays | Customize appearance per control, cancel display conditionally, adjust location |
| Fires during tooltip rendering | Implement custom drawing, override default appearance |
Syncfusion.Core.WinForms.dllSyncfusion.Shared.BaseSyncfusion.Core.WinFormsInitialDelayAutoPopDelay