예제 #1
0
        private void SetAnnotationStyle()
        {
            if (AnnotationStyle == null || AnnotationStyle.SelectedIndex == -1)
            {
                return;
            }

            if (Annotation.SelectedItem.Value.ToLower().IndexOf("line") >= 0)
            {
                Chart1.Annotations[0].LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle.SelectedItem.Value);
            }

            else if (Annotation.SelectedItem.Value == "Text" ||
                     Annotation.SelectedItem.Value == "Rectangle" ||
                     Annotation.SelectedItem.Value == "Ellipse")
            {
                Chart1.Annotations[0].TextStyle =
                    (TextStyle)TextStyle.Parse(typeof(TextStyle), AnnotationStyle.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Arrow")
            {
                ((ArrowAnnotation)Chart1.Annotations[0]).ArrowStyle =
                    (ArrowStyle)ArrowStyle.Parse(typeof(ArrowStyle), AnnotationStyle.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Border3D")
            {
                ((Border3DAnnotation)Chart1.Annotations[0]).BorderSkin.SkinStyle =
                    (BorderSkinStyle)BorderSkinStyle.Parse(typeof(BorderSkinStyle), AnnotationStyle.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Callout")
            {
                ((CalloutAnnotation)Chart1.Annotations[0]).CalloutStyle =
                    (CalloutStyle)CalloutStyle.Parse(typeof(CalloutStyle), AnnotationStyle.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Polygon")
            {
                PolygonAnnotation annotation = (PolygonAnnotation)Chart1.Annotations[0];

                annotation.BackColor = Color.FromArgb(128, Color.FromName(AnnotationStyle.SelectedItem.Value));
            }
        }
예제 #2
0
        private void AnnotationStyle_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (Annotation.SelectedItem.ToString().ToLower().IndexOf("line") >= 0)
            {
                Chart1.Annotations[0].LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Text" ||
                     Annotation.SelectedItem.ToString() == "Rectangle" ||
                     Annotation.SelectedItem.ToString() == "Ellipse")
            {
                //FIXFIX

                /*
                 *              Chart1.Annotations[0].TextStyle =
                 *                      (TextStyle)TextStyle.Parse(typeof(TextStyle), AnnotationStyle.SelectedItem.ToString());*/
            }
            else if (Annotation.SelectedItem.ToString() == "Arrow")
            {
                ((ArrowAnnotation)Chart1.Annotations[0]).ArrowStyle =
                    (ArrowStyle)ArrowStyle.Parse(typeof(ArrowStyle), AnnotationStyle.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Border3D")
            {
                ((Border3DAnnotation)Chart1.Annotations[0]).BorderSkin.SkinStyle =
                    (BorderSkinStyle)BorderSkinStyle.Parse(typeof(BorderSkinStyle), AnnotationStyle.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Callout")
            {
                ((CalloutAnnotation)Chart1.Annotations[0]).CalloutStyle =
                    (CalloutStyle)CalloutStyle.Parse(typeof(CalloutStyle), AnnotationStyle.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Polygon")
            {
                PolygonAnnotation annotation = (PolygonAnnotation)Chart1.Annotations[0];

                annotation.BackColor = Color.FromArgb(128, Color.FromName(AnnotationStyle.SelectedItem.ToString()));
            }
        }