【发布时间】:2019-06-09 16:45:51
【问题描述】:
我有两个注释文本和行,并希望使用 AnnotationGroup 类组合成单个注释。我使用了以下代码:
Dim line As New HorizontalLineAnnotation
With line
.IsSizeAlwaysRelative = False
.ClipToChartArea = Chart1.ChartAreas(0).Name
.IsInfinitive = True
.LineColor = Color.Black
.LineDashStyle = ChartDashStyle.Dash
.LineWidth = 2
End With
Dim text As New TextAnnotation
With text
.IsSizeAlwaysRelative = False
.Text = "something"
.ForeColor = line.LineColor
End With
Dim group As New AnnotationGroup
With group
.AxisX = Chart1.ChartAreas(0).AxisX
.AxisY = Chart1.ChartAreas(0).AxisY
.AnchorX = 0
.AnchorY = 10
.Annotations.Add(line)
.Annotations.Add(text)
End With
Chart1.Annotations.Add(group)
编译的代码没有任何错误,但图表区域没有显示任何内容。 我无法弄清楚。 MSDN 对此也只字未提。
谢谢。
【问题讨论】: