Page 1 of 1
Select and Delete Annotation Rectangle
Posted: Sun Jun 05, 2011 2:20 am
by 15657351
Hi,
What is the best to select and delete annotation rectangle already placed on a chart?
Re: Select and Delete Annotation Rectangle
Posted: Mon Jun 06, 2011 9:19 am
by 10050769
Hello lilo,
Can you explain exactly, step to step, what do you achieve that annotation do in your application?
Thanks,
Re: Select and Delete Annotation Rectangle
Posted: Mon Jun 06, 2011 9:32 am
by yeray
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);
}
}
Re: Select and Delete Annotation Rectangle
Posted: Mon Jun 06, 2011 1:31 pm
by 15657351
Thanks Yeray, That's what I want to do.