Page 1 of 1

Adding click event to annotation

Posted: Sun May 27, 2012 9:35 pm
by 15660116
I would like to add a click event to annotation tool array created at runtime

NumAnnoText=NumAnnoText+1
Dim AnnotationChart() As Steema.TeeChart.Tools.RectangleTool
ReDim Preserve AnnotationChart(NumAnnoText)
AnnotationChart(NumAnnoText) = New Steema.TeeChart.Tools.RectangleTool(TChart1.Chart)

Is it possible to add a click event?

Re: Adding click event to annotation

Posted: Mon May 28, 2012 2:19 pm
by 10050769
Hello lilo,

To use the click event of annotation tool you only need do next:
C#

Code: Select all

public Form1()
        {
            InitializeComponent();
            ann.Click += new MouseEventHandler(ann_Click);
         }

        void ann_Click(object sender, MouseEventArgs e)
        {
            
           this.Text = e.X.ToString()+","+e.Y.ToString();
        }
VB

Code: Select all

Public Sub New()
	InitializeComponent()
    AddHandler ann.Click, Addressof ann_Click;
End Sub

Private Sub ann_Click(sender As Object, e As MouseEventArgs)

	Me.Text = e.X.ToString() & "," & e.Y.ToString()
End Sub
Can you tell if it works as you expect?

I hope will helps.

Thanks,