public void CreateNewStarAnnotation()
        {
            // Create annotation group and add it to the chart annotations collection
            AnnotationGroup star = new AnnotationGroup();
            star.X = 20;
            star.Y = 20;
            star.Width = 30;
            star.Height = 20;
            star.AllowSelecting = true;
            star.AllowMoving = true;
            star.AllowResizing = true;

            Chart1.Annotations.Add(star);

            // Add star shaped polygon annotation into the group

            PointF[] starPolygon = new PointF[] {
                                                    new PointF(1,6), new PointF(27,23), new PointF(33,5), new PointF(44,22), new PointF(58,0),
                                                    new PointF(57,19), new PointF(75,11), new PointF(70,28), new PointF(100,37), new PointF(81,53),
                                                    new PointF(99,65), new PointF(75,67), new PointF(87,98), new PointF(63,69), new PointF(60,94),
                                                    new PointF(47,69), new PointF(34,100), new PointF(32,69), new PointF(23,74), new PointF(26,61),
                                                    new PointF(4,72), new PointF(22,49), new PointF(0,39), new PointF(23,32), new PointF(1,6) };

            GraphicsPath starPath = new GraphicsPath();

            starPath.AddPolygon(starPolygon);
            PolygonAnnotation poly = new PolygonAnnotation();
            poly.Name = "Star";
            poly.GraphicsPath = starPath;
            star.Annotations.Add(poly);

            // Set star polygon annotation position and appearance
            star.Annotations["Star"].X = 0;
            star.Annotations["Star"].Y = 0;
            star.Annotations["Star"].Width = 100;
            star.Annotations["Star"].Height = 100;
            star.Annotations["Star"].LineColor = Color.FromArgb(64,64,64);
            star.Annotations["Star"].BackColor = Color.FromArgb(220,255,255,192);
            star.Annotations["Star"].ShadowOffset = 2;

            // Add text in the middle of the star shape
            TextAnnotation textAnnotation = new TextAnnotation();
            textAnnotation.Name = "StarText";
            textAnnotation.Text = "New !!!";
            textAnnotation.X = 20;
            textAnnotation.Y = 20;
            textAnnotation.Width = 60;
            textAnnotation.Height = 60;
            star.Annotations.Add(textAnnotation);
            star.Annotations["StarText"].Font = new Font("MS Sans Serif", 10, FontStyle.Bold|FontStyle.Italic);
            star.Annotations["StarText"].ForeColor= Color.FromArgb(26, 59, 105);
        }
        /// <summary>
        /// Mouse was double clicked.
        /// </summary>
        internal void OnDoubleClick()
        {
            if (lastClickedAnnotation != null &&
                lastClickedAnnotation.AllowTextEditing)
            {
                TextAnnotation textAnnotation = lastClickedAnnotation as TextAnnotation;

                if (textAnnotation == null)
                {
                    AnnotationGroup group = lastClickedAnnotation as AnnotationGroup;

                    if (group != null)
                    {
                        // Try to edit text annotation in the group
                        foreach (Annotation annot in group.Annotations)
                        {
                            TextAnnotation groupAnnot = annot as TextAnnotation;
                            if (groupAnnot != null &&
                                groupAnnot.AllowTextEditing)
                            {
                                // Get annotation position in relative coordinates
                                PointF firstPoint  = PointF.Empty;
                                PointF anchorPoint = PointF.Empty;
                                SizeF  size        = SizeF.Empty;
                                groupAnnot.GetRelativePosition(out firstPoint, out size, out anchorPoint);
                                RectangleF textPosition = new RectangleF(firstPoint, size);

                                // Check if last clicked coordinate is inside this text annotation
                                if (groupAnnot.GetGraphics() != null &&
                                    textPosition.Contains(groupAnnot.GetGraphics().GetRelativePoint(this._movingResizingStartPoint)))
                                {
                                    textAnnotation        = groupAnnot;
                                    lastClickedAnnotation = textAnnotation;
                                    break;
                                }
                            }
                        }
                    }
                }

                if (textAnnotation != null)
                {
                    // Start annotation text editing
                    textAnnotation.BeginTextEditing();
                }
            }
        }
        internal void ChartAreaNameReferenceChanged(object sender, NameReferenceChangedEventArgs e)
        {
            // If all the chart areas are removed and then a new one is inserted - Annotations don't get bound to it by default
            if (e.OldElement == null)
            {
                return;
            }

            foreach (Annotation annotation in this)
            {
                if (annotation.ClipToChartArea == e.OldName)
                {
                    annotation.ClipToChartArea = e.NewName;
                }

                AnnotationGroup group = annotation as AnnotationGroup;
                if (group != null)
                {
                    group.Annotations.ChartAreaNameReferenceChanged(sender, e);
                }
            }
        }
        /// <summary>
        /// Finds an annotation in the collection by name.
        /// </summary>
        /// <param name="name">
        /// Name of the annotation to find.
        /// </param>
        /// <returns>
        /// <see cref="Annotation"/> object, or null (or nothing) if it does not exist.
        /// </returns>
        public override Annotation FindByName(string name)
        {
            foreach (Annotation annotation in this)
            {
                // Compare annotation name
                if (annotation.Name == name)
                {
                    return(annotation);
                }

                // Check if annotation is a group
                AnnotationGroup annotationGroup = annotation as AnnotationGroup;
                if (annotationGroup != null)
                {
                    Annotation result = annotationGroup.Annotations.FindByName(name);
                    if (result != null)
                    {
                        return(result);
                    }
                }
            }

            return(null);
        }