Sample code as follows: --------Use it in your label's paint event Graphics gLable = yourLabel.CreateGraphics(); StringFormat sfLabel = new StringFormat(); sfLabel.Alignment = StringAlignment.Near; sfLabel.FormatFlags |= StringFormatFlags.FitBlackBox;//See it detail in msdn// Draw string fit to your label bound. gLabel.DrawString( yourLabel.Text, yourLabel.Font, new brush( yourLabel.BackColor), new rectangle( 0, 0, yourLabel.Width, yourLabel.Height ), sfLabel );
--------Use it in your label's paint event
Graphics gLable = yourLabel.CreateGraphics();
StringFormat sfLabel = new StringFormat();
sfLabel.Alignment = StringAlignment.Near;
sfLabel.FormatFlags |= StringFormatFlags.FitBlackBox;//See it detail in msdn// Draw string fit to your label bound.
gLabel.DrawString( yourLabel.Text,
yourLabel.Font,
new brush( yourLabel.BackColor),
new rectangle( 0, 0, yourLabel.Width, yourLabel.Height ),
sfLabel );