Use TextRenderer.DrawText with TextFormatFlags.PathEllipsis flag
void label_Paint(object sender, PaintEventArgs e)
{
Label label = (Label)sender;
TextRenderer.DrawText(e.Graphics, label.Text, label.Font, label.ClientRectangle, label.ForeColor, TextFormatFlags.PathEllipsis);
}
Your code is 95% there. The only
problem is that the trimmed text is
drawn on top of the text which is
already on the label.
Yes thanks, I was aware of that. My intention was only to demonstrate use of DrawText method. I didn't know whether you want to manually create event for each label or just override OnPaint() method in inherited label. Thanks for sharing your final solution though.