May 25, 2005

Useful Drawstring function

This version of Drawstring is useful it will fit the string to the given rectangle, automatically wrapping it as appropriate.
 Rectangle rect = this.ClientRectangle;
 graphics.Clear(Color.Black);
 rect.Inflate(-1,-1);
 graphics.DrawString(string.Concat("Onpaint error: \'", exception.Message, "\'")
  , theFont, Brushes.Red, rect);

No comments: