Code: Select all
Private Sub Form_Load()
TChart1.AddSeries scArea
TChart1.Series(0).FillSampleValues (10)
TChart1.Legend.Visible = True
End Sub
Private Sub TChart1_OnLegendDrawSymbol(ByVal Series As Long, ByVal ValueIndex As Long, ByVal Left As Long, ByVal Top As Long, ByVal Right As Long, ByVal Bottom As Long)
TChart1.Canvas.Pen.Color = RGB(0, 0, 255)
TChart1.Canvas.Pen.Style = psSolid
'Can't do this, it fails
'TChart1.Canvas.Brush.ClearImage
TChart1.Canvas.Brush.Color = RGB(255, 0, 0)
TChart1.Canvas.Brush.Style = bsCrossSmall
TChart1.Canvas.BackColor = RGB(0, 255, 0)
TChart1.Canvas.BackMode = cbmOpaque
TChart1.Canvas.Rectangle Left, Top, Right, Bottom
End Sub
My standard way of fixing this is a strategically placed Brush.ClearImage() call, but when called on the canvas brush here, it fails/crashes.
Note that I am doing this in the first place because it appears the standard drawing code for the legend inverts the foreground and background colors for the brushes. For example, running below:
Code: Select all
Private Sub Form_Load()
TChart1.AddSeries scArea
TChart1.Series(0).FillSampleValues (10)
TChart1.Legend.Visible = True
TChart1.Series(0).asArea.AreaChartBrush.Color = RGB(255, 0, 0)
TChart1.Series(0).asArea.AreaChartBrush.Style = bsDiagSmall
TChart1.Series(0).asArea.AreaColor = RGB(0, 255, 0)
End Sub
So, I guess if either one of these issues is fixed, it will help me.
Thanks.