Select and Delete Annotation Rectangle

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
lilo
Newbie
Newbie
Posts: 29
Joined: Thu Sep 30, 2010 12:00 am

Select and Delete Annotation Rectangle

Post by lilo » Sun Jun 05, 2011 2:20 am

Hi,

What is the best to select and delete annotation rectangle already placed on a chart?

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

Re: Select and Delete Annotation Rectangle

Post by Sandra » Mon Jun 06, 2011 9:19 am

Hello lilo,

Can you explain exactly, step to step, what do you achieve that annotation do in your application?

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

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Select and Delete Annotation Rectangle

Post by Yeray » Mon Jun 06, 2011 9:32 am

Hello lilo,

If what you want is to select an annotation clicking over it and remove it with, for example, the "Supr" key, you could use the Selector Tool and the events as follows:

Code: Select all

        private Steema.TeeChart.Tools.Selector sel1;
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            tChart1.Legend.Visible = false;

            sel1 = new Steema.TeeChart.Tools.Selector(tChart1.Chart);

            Steema.TeeChart.Tools.Annotation annot = new Steema.TeeChart.Tools.Annotation(tChart1.Chart);
            annot.Left = 100;
            annot.Top = 100;
            annot.Text = "Testing annotation";
            Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar1.FillSampleValues();

            tChart1.KeyDown += new KeyEventHandler(tChart1_KeyDown);
        }

        void tChart1_KeyDown(object sender, KeyEventArgs e)
        {
            if ((sel1.Selection is Steema.TeeChart.Tools.Annotation) && (e.KeyData == Keys.Delete))
            {
                tChart1.Tools.Remove(sel1.Selection as Steema.TeeChart.Tools.Annotation);
            }
        }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

lilo
Newbie
Newbie
Posts: 29
Joined: Thu Sep 30, 2010 12:00 am

Re: Select and Delete Annotation Rectangle

Post by lilo » Mon Jun 06, 2011 1:31 pm

Thanks Yeray, That's what I want to do.

Post Reply