TextRenderer doesn't draw a long string

前端 未结 1 1616
醉话见心
醉话见心 2021-01-23 03:33

Look at this sample:

public partial class Form1 : Form
{
    private static string myString = null;

    private const int MAX_TEXT = 5460;

    public Form1()
          


        
相关标签:
1条回答
  • 2021-01-23 04:15

    I think you hit the limitation of the TextRenderer class, which I think is calling the DrawTextEx API function under the hood. If you try to put your builder.ToString() results into a TextBox, it won't show up either.

    If for some reason you need to print a string that long, you would have to revert back to the DrawString method:

    e.Graphics.DrawString(myString, this.Font, Brushes.Black, new Point(10, 30));
    
    0 讨论(0)
提交回复
热议问题