如何让长标题自动换行
这个例子阐述自动换行在运行状态下对图表标题有效。补充一点,你可以决定最大换行数。
// 创建一个标题并添加到图表集
ChartTitle chartTitle1 = new ChartTitle();
ChartControl1.Titles.Add(chartTitle1);
chartTitle1.Text = "Just a Very Lengthy Title for Such a Small Chart";
// 激活标题自动换行
// 并并以行数限制
chartTitle1.WordWrap = true;
chartTitle1.MaxLineCount = 2;
效果如图
标题仍旧被省略,因为超过了两行的限制。如果有需要,你可以增加DockableTitle.MaxLineCount 该属性的值,已得到后图的效果。当然,后图也因此变皱了。