title: Draw a multiline text in an image in Asp.Net MVC
body: <p>I am trying to draw a text in an image, but the problem is that when the text is long it goes out of the image.  I need to define a limit to break the text in to or more lines.
  Can you help me?
  Thanks!</p>
  
  <p><a href="https://i.stack.imgur.com/yg0WN.png" rel="nofollow noreferrer">screenshot</a></p>
  
  <pre><code>       string text = "This is an example of text that the user will type";
     Font font = new Font("Arial", 25, FontStyle.Regular, GraphicsUnit.Pixel);
  
     canvas3.SmoothingMode = SmoothingMode.AntiAlias;
     canvas3.InterpolationMode = InterpolationMode.HighQualityBilinear;
     canvas3.PixelOffsetMode = PixelOffsetMode.HighQuality;
     canvas3.TextRenderingHint = TextRenderingHint.AntiAlias;
     // Set format of string.
     StringFormat drawFormat = new StringFormat();
  
     canvas3.DrawString(text, font, new SolidBrush(Color.FromArgb(0,0,0)), 50, 50, drawFormat);
  </code></pre>