带有多色文本的图表标注注释

时间:2019-04-10 15:41:36

标签: vb.net mschart

我的图表上有一个标注注释,该注释使用ForeColor属性以红色显示文本变量名称“ StringContent”。 但我想要自定义文本颜色,即某些文本将是蓝色,有些文本将是红色。我已经搜索了MSDN,没有任何OnPaint方法可以覆盖以进行自定义标注。请指导我。谢谢。 该代码段如下所示:

Chart1.Annotations.Clear()
            ta = New CalloutAnnotation
            With ta
                .AnchorDataPoint = Chart1.Series(0).Points(result.PointIndex)
                .Text = ":::    {  - - DETAILS  - - }    ::: " & StrDup(2, vbLf) & StringContent
                .ForeColor = Color.Red 

                .Text += "Blue Colored Text Will Go here"
                .ForeColor = Color.Blue  '// With this line all text obviously will go blue

                .ShadowColor = Color.Black
                .ShadowOffset = 2

                .Font = New Font("Franklin Gothic Book", 9.5, FontStyle.Regular)
                .SmartLabelStyle.MovingDirection = LabelAlignmentStyles.Center
                .SmartLabelStyle.AllowOutsidePlotArea = LabelOutsidePlotAreaStyle.No
                .AllowMoving = True
            End With

0 个答案:

没有答案