Adding click event to annotation

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
lilo
Newbie
Newbie
Posts: 62
Joined: Wed Sep 07, 2011 12:00 am

Adding click event to annotation

Post by lilo » Sun May 27, 2012 9:35 pm

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?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Adding click event to annotation

Post by Sandra » Mon May 28, 2012 2:19 pm

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply