Been trying to figure out the cause of why my balloon sizes are changed and the text in them is getting cropped as a result. I thought it had to do with re-setting the tip text for a control. Nope. It turns out it is the cancelling of popOpen. Once you cancel, it will adversely affect the next balloon to open.
Anyone have some brilliant ideas on a work-around?
Here's the code: (to reproduce the bug, run it and mouseOver l3, then l2, then l, then l3 - in that order).
public partial class Form7 : Form
{
private Label l, l2, l3;
public Form7()
{
InitializeComponent();
toolTip1.IsBalloon = true;
toolTip1.Popup += new PopupEventHandler(toolTip1_Popup);
l = new Label();
l.Name="l";
l.Text = "Label 1";
l.Top = 100;
l.Left = 100;
l2 = new Label();
l2.Name="l2";
l2.Text = "Label 2";
l2.Top = 150;
l2.Left = 100;
l3 = new Label();
l3.Name = "l3";
l3.Text = "Label 3";
l3.Top = 200;
l3.Left = 100;
this.Controls.Add(l);
this.Controls.Add(l2);
this.Controls.Add(l3);
toolTip1.SetToolTip(l, "Hello.");
toolTip1.SetToolTip(l2, "This is longer.");
toolTip1.SetToolTip(l3, "This is even longer than Label 2.");
}
void toolTip1_Popup(object sender, PopupEventArgs e)
{
Control c = e.AssociatedControl;
if (c.Name == "l")
e.Cancel = true; // <--- This is the culprit!
else
e.ToolTipSize = new Size(400, 100); // <--- This sems to have no effect when isBalloon == true.
}
}