private void chartControl1_CustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
        {
            if (!handleCustomDraw)
            {
                return;
            }

            // Specify the crosshair argument line color, dash style and thickness.
            e.CrosshairLineElement.Brush = Brushes.Aqua;
            e.CrosshairLineElement.LineStyle.DashStyle = DashStyles.DashDot;
            e.CrosshairLineElement.LineStyle.Thickness = 3;

            // Specify  the back color for crosshair argument label.
            foreach (CrosshairAxisLabelElement axisLabelElement in e.CrosshairAxisLabelElements)
            {
                axisLabelElement.Background = Brushes.Blue;
            }

            foreach (CrosshairElementGroup group in e.CrosshairElementGroups)
            {
                CrosshairElement element = group.CrosshairElements[0];

                // Specify the color, dash style and thickness for the crosshair value lines.
                element.LineElement.Brush = Brushes.DarkViolet;
                element.LineElement.LineStyle.DashStyle = DashStyles.Dash;
                element.LineElement.LineStyle.Thickness = 2;

                // Specify the  font size and background for the crosshair value labels.
                element.AxisLabelElement.FontSize   = 14;
                element.AxisLabelElement.Background = Brushes.Red;

                // Specify the foreground and  font size for the crosshair  cursor label that shows series.
                if (element.SeriesPoint.Value > 50)
                {
                    element.LabelElement.Foreground = Brushes.Green;
                    element.LabelElement.FontSize   = 14;
                }
            }

            foreach (CrosshairElementGroup group in e.CrosshairElementGroups)
            {
                CrosshairGroupHeaderElement groupHeaderElement = group.HeaderElement;

                // Specify the text, text color and font for the crosshair group header element.
                groupHeaderElement.Text       = "Custom draw";
                groupHeaderElement.Foreground = Brushes.Red;
                groupHeaderElement.FontSize   = 15;
            }
        }
Esempio n. 2
0
        private void OnChartControlCustomDrawCrosshair(object sender, CustomDrawCrosshairEventArgs e)
        {
            // Specify the crosshair argument line color, dash style and thickness.
            e.CrosshairLineElement.Color = Color.Green;
            e.CrosshairLineElement.LineStyle.DashStyle = DashStyle.DashDot;
            e.CrosshairLineElement.LineStyle.Thickness = 3;

            // Specify the back color for the crosshair argument axis label.
            foreach (CrosshairAxisLabelElement axisLabelElement in e.CrosshairAxisLabelElements)
            {
                axisLabelElement.BackColor = Color.Blue;
            }

            foreach (CrosshairElementGroup group in e.CrosshairElementGroups)
            {
                CrosshairGroupHeaderElement groupHeaderElement = group.HeaderElement;

                // Specify the text, text color and font for the crosshair group header element.
                groupHeaderElement.Text      = "Custom draw";
                groupHeaderElement.TextColor = Color.Green;
                groupHeaderElement.Font      = SystemFonts.DefaultFont;

                // Obtain the first series.
                CrosshairElement element = group.CrosshairElements[0];

                // Specify the color, dash style and thickness for the crosshair value lines.
                element.LineElement.Color = Color.DarkViolet;
                element.LineElement.LineStyle.DashStyle = DashStyle.Dash;
                element.LineElement.LineStyle.Thickness = 2;

                // Specify the text color and back color for the crosshair value labels.
                element.AxisLabelElement.TextColor = Color.Red;
                element.AxisLabelElement.BackColor = Color.Yellow;

                // Format the text shown for the series in the crosshair cursor label. Specify the text color and marker size.
                element.LabelElement.TextColor  = Color.Red;
                element.LabelElement.MarkerSize = new Size(15, 15);
                element.LabelElement.Text       = string.Format("{0}: A={1}; V={2}", element.Series.Name, element.SeriesPoint.Argument, element.SeriesPoint.Values[0]);
            }
        }
Esempio n. 3
0
        protected void Mychart_CustomCrosshairsPoint(object sender, CustomDrawCrosshairEventArgs e)
        {
            e.CrosshairLineElement.Color = Color.Green;
            e.CrosshairLineElement.LineStyle.DashStyle = DashStyle.DashDot;
            e.CrosshairLineElement.LineStyle.Thickness = 3;

            // Specify  the back color for crosshair argument label.
            foreach (CrosshairAxisLabelElement axisLabelElement in e.CrosshairAxisLabelElements)
            {
                axisLabelElement.BackColor = Color.Blue;
            }

            foreach (CrosshairElementGroup group in e.CrosshairElementGroups)
            {
                CrosshairElement element = group.CrosshairElements[0];

                // Specify the color, dash style and thickness for the crosshair value lines.
                element.LineElement.Color = Color.DarkViolet;
                element.LineElement.LineStyle.DashStyle = DashStyle.Dash;
                element.LineElement.LineStyle.Thickness = 2;

                // Specify the  text color and back color for the crosshair value labels.
                element.AxisLabelElement.TextColor = Color.Red;
                element.AxisLabelElement.BackColor = Color.Yellow;

                // Specify the text color and marker size for the crosshair  cursor label that shows series.
                element.LabelElement.TextColor  = Color.Red;
                element.LabelElement.MarkerSize = new Size(15, 15);
            }

            foreach (CrosshairElementGroup group in e.CrosshairElementGroups)
            {
                CrosshairGroupHeaderElement groupHeaderElement = group.HeaderElement;

                // Specify the text, text color and font for the crosshair group header element.
                groupHeaderElement.Text      = "Custom draw";
                groupHeaderElement.TextColor = Color.Green;
                //groupHeaderElement.Font = new Font(this.Font, FontStyle.Bold);
            }
        }