Custom drawing on the Chart Panel
Posted: Tue Feb 03, 2009 7:38 am
Dear Sirs,
How to remove "My Text" when I click "Clear Button"?
How to remove "My Text" when I click "Clear Button"?
Code: Select all
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler TChart1.AfterDraw, AddressOf After_Draw
End Sub
Private Sub After_Draw(ByVal sender As Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D)
Dim Text As String = "My Text"
Dim S As New Size(50, 50)
Dim P As New Point(g.ChartXCenter - (S.Width / 2), g.ChartYCenter - (S.Height / 2))
Dim R As New Rectangle(P, S)
g.Pen.Color = Color.Blue
g.Rectangle(R)
g.TextOut(Convert.ToInt32(g.ChartXCenter - (g.TextWidth(Text) / 2)), Convert.ToInt32(g.ChartYCenter - (g.TextHeight(Text) / 2)), Text)
End Sub
Private Sub Clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clear.Click
'Remove "My Text"
End Sub