首页 > 解决方案 > 带有多色文本的图表标注注释

问题描述

我的图表上有一个标注注释,它使用 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

标签: vb.netmschart

解决方案


推荐阅读