答案 0 :(得分:1)
tcLegendScrollBar
工具旨在显示图例中不适合图例矩形的项目,而不是限制项目中显示的字符数。这是一个例子:
Private Sub Form_Load()
TChart1.Aspect.View3D = False
Dim i As Integer
For i = 0 To 10
TChart1.AddSeries scFastLine
TChart1.Series(i).FillSampleValues 10
TChart1.Series(i).Title = "this is a very very veeeeeeery long string to be shown in the legend as title for the series " + Str$(i)
Next i
TChart1.Legend.MaxNumRows = 5
TChart1.Tools.Add tcLegendScrollBar
End Sub
要限制图例中字符串的长度,您可以使用OnGetLegendText
事件。即:
Private Sub TChart1_OnGetLegendText(ByVal LegendStyle As Long, ByVal ValueIndex As Long, LegendText As String)
LegendText = Left$(LegendText, 10) + "..."
End Sub