看看这个样本:
public partial class Form1 : Form
{
private static string myString = null;
private const int MAX_TEXT = 5460;
public Form1()
{
InitializeComponent();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < MAX_TEXT; i++)
{
builder.Append('a');
}
myString = builder.ToString();
this.Paint += Form1_Paint;
}
void Form1_Paint(object sender, PaintEventArgs e)
{
TextRenderer.DrawText(
e.Graphics,
myString,
this.Font,
new Point(10, 30),
Color.Black);
}
}
当我将 设置MAX_TEXT
为 5461 时,不绘制字符串。您知道本机机制是否对绘制文本有限制,是否/或我可以设置选项以使其正常工作?