> A rather longish bit of text, may a really long
> pathname or something similar
private void textBox1_MouseHover(object sender, System.EventArgs e)
{
this.toolTip1.SetToolTip( ((TextBox)sender), ((TextBox)sender).Text );
this.toolTip1.Active = true;
}
Richard - 28 Sep 2007 17:38 GMT
> > A rather longish bit of text, may a really long
> > pathname or something similar
[quoted text clipped - 5 lines]
>
> }
Thanks Dave,
I ended up with this little more complicated mousehover handler. The
'in-place' part is ensuring the tool tip overlays the text field very
closely (things can be minorly different if different fonts for
tooltip and textbox)
TextBox t = (TextBox)sender;
Point p = this.PointToClient(t.PointToScreen(t.Location));
p.X = p.X + SystemInformation.BorderSize.Width *
SystemInformation.BorderMultiplierFactor - 1;
p.Y = p.Y + SystemInformation.BorderSize.Height *
SystemInformation.BorderMultiplierFactor + 1;
toolTip1.Show(t.Text, this, p, 5000);
Richard