string buttontooltip = "click here";
public Form1()
{
InitializeComponent();
toolTip1.SetToolTip(button1, buttontooltip);
toolTip1.OwnerDraw = true;
toolTip1.Draw += new DrawToolTipEventHandler(toolTip1_Draw);
toolTip1.Popup += new PopupEventHandler(toolTip1_Popup);
}
void toolTip1_Popup(object sender, PopupEventArgs e)
{
e.ToolTipSize = TextRenderer.MeasureText(buttontooltip, new Font("Arial", 16.0f));
}
void toolTip1_Draw(object sender, DrawToolTipEventArgs e)
{
using (e.Graphics)
{
Font f = new Font("Arial", 16.0f);
e.DrawBackground();
e.DrawBorder();
buttontooltip = e.ToolTipText;
e.Graphics.DrawString(e.ToolTipText, f, Brushes.Red, new PointF(2, 2));
}
}
No comments:
Post a Comment