0

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!

screenshot

       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);
  • possible duplicate of https://stackoverflow.com/questions/9507842/drawstring-word-wrap-or-display-entire-text – Nitin Sawant Jul 05 '18 at 04:25
  • Possible duplicate of [Drawstring word wrap or display entire text](https://stackoverflow.com/questions/9507842/drawstring-word-wrap-or-display-entire-text) – Nitin Sawant Jul 05 '18 at 04:25

0 Answers0