void HandleTabTextChanged(object sender, EventArgs e)
{
var btn = sender as Messir.Windows.Forms.TabStripButton;
if (btn != null)
{
const string kEllipsis = "\u2026";
// Preserve the original string as the tooltip.
if (!btn.Text.EndsWith(kEllipsis))
btn.ToolTipText = btn.Text;
// Ensure the button width is no more than 110 pixels.
if (btn.Width > 110)
{
using (Graphics g = btn.Owner.CreateGraphics())
{
btn.Text = ShortenStringToFit(btn.Text, 110, btn.Width, btn.Font, g);
}
}
}
AdjustToolPanelLocation(false);
}