I've been having a play with the idea and come up with a little demo to explain what I mean. OK first I made this class which is based on a standard inherited ToolTip:
Code:
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
class CustomToolTip : ToolTip
{
public CustomToolTip()
{
this.OwnerDraw = true;
this.Popup += new PopupEventHandler(this.OnPopup);
this.Draw += new DrawToolTipEventHandler(this.OnDraw);
}
private void OnPopup(object sender, PopupEventArgs e) // use this event to set the size of the tool tip
{
e.ToolTipSize = new Size(200, 100);
}
private void OnDraw(object sender, DrawToolTipEventArgs e) // use this event to customise the tool tip
{
Graphics g = e.Graphics;
LinearGradientBrush b = new LinearGradientBrush(e.Bounds,
Color.GreenYellow, Color.MintCream, 45f);
g.FillRectangle(b, e.Bounds);
g.DrawRectangle(new Pen(Brushes.Red, 1), new Rectangle(e.Bounds.X, e.Bounds.Y,
e.Bounds.Width - 1, e.Bounds.Height - 1));
g.DrawString(e.ToolTipText, new Font(e.Font, FontStyle.Bold), Brushes.Silver,
new PointF(e.Bounds.X + 6, e.Bounds.Y + 6)); // shadow layer
g.DrawString(e.ToolTipText, new Font(e.Font, FontStyle.Bold), Brushes.Black,
new PointF(e.Bounds.X + 5, e.Bounds.Y + 5)); // top layer
b.Dispose();
}
}
}
In the Draw event, you can see I've added a gradient background, a red border, and some double layered text. You can change all that to whatever you want.
Then for demonstration, create a button on your form and add a Hover event:
Code:
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private CustomToolTip tip;
public Form1()
{
InitializeComponent();
this.tip = new CustomToolTip();
}
private void button1_MouseHover(object sender, EventArgs e)
{
this.tip.SetToolTip(this.button1, "this is a test");
}
}
}
Run the program, and let your mouse rest on top of the button. As you can see, it's as simple as using a standard ToolTip.