Exemplo n.º 1
0
        public void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)
        {
            // draw a circle for each point
            for (int i = 0; i < m_Points.Count; i++)
            {
                MousePoint site = m_Points[i];
                Point      p    = site.Location;
                float      sz   = site.Size;

                if (sz > 0)
                {
                    NStrokeStyle strokeStyle = null;

                    if ((site.MouseButtons & MouseButtons.Left) != 0)
                    {
                        strokeStyle = m_StrokeCrimson;
                    }
                    else
                    {
                        strokeStyle = m_StrokeMediumSeaGreen;
                    }

                    if ((site.MouseButtons & MouseButtons.Right) != 0)
                    {
                        sz *= 4;
                    }

                    eventArgs.Graphics.PaintEllipse(null, strokeStyle, new NRectangleF(p.X - sz / 2, p.Y - sz / 2, sz, sz));
                }
            }
        }
Exemplo n.º 2
0
            /// <summary>
            /// Occurs before the panel is painted.
            /// </summary>
            /// <param name="panel"></param>
            /// <param name="eventArgs"></param>
            public override void OnBeforePaint(NPanel panel, NPanelPaintEventArgs eventArgs)
            {
                NChart chart = (NChart)panel;

                double dAxisMin = chart.Axis(StandardAxis.PrimaryY).Scale.RulerRange.Begin;
                double dAxisMax = chart.Axis(StandardAxis.PrimaryY).Scale.RulerRange.End;

                m_UserControl.labelMinValue.Text = dAxisMin.ToString();
                m_UserControl.labelMaxValue.Text = dAxisMax.ToString();
            }
Exemplo n.º 3
0
            public override void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)
            {
                if (m_Parent.m_bUpdateWatermark == false)
                {
                    return;
                }

                // intercepts the on chart after paint event and converts
                // point or XYZ coordniates to chart viewport coordinates
                // used to position the custom watermark
                NChartControl chartControl = m_Parent.nChartControl1;
                NWatermark    watermark    = chartControl.Watermarks[0];
                NChart        chart        = m_Parent.nChartControl1.Charts[0];

                NPointF    viewPoint     = new NPointF();
                NVector3DF vecModelPoint = new NVector3DF();

                NModel3DToViewTransformation model3DToViewTransformation = new NModel3DToViewTransformation(chartControl.View.Context, chart.Projection);

                switch (m_Parent.WatermarkPositionComboBox.SelectedIndex)
                {
                case 0:
                    vecModelPoint.X = chart.Axis(StandardAxis.PrimaryX).TransformScaleToModel(false, (double)m_Parent.XPositionNumericUpDown.Value);
                    vecModelPoint.Y = chart.Axis(StandardAxis.PrimaryY).TransformScaleToModel(false, (double)m_Parent.YPositionNumericUpDown.Value);
                    vecModelPoint.Z = chart.Axis(StandardAxis.Depth).TransformScaleToModel(false, (double)m_Parent.ZPositionNumericUpDown.Value);
                    break;

                case 1:
                    NVector3DF vecPoint = new NVector3DF();
                    int        nIndex   = (int)m_Parent.DataPointNumericUpDown.Value;

                    vecPoint.X = (float)(double)(m_Parent.m_Point.XValues[nIndex]);
                    vecPoint.Y = (float)(double)(m_Parent.m_Point.Values[nIndex]);
                    vecPoint.Z = (float)(double)(m_Parent.m_Point.ZValues[nIndex]);

                    vecModelPoint.X = chart.Axis(StandardAxis.PrimaryX).TransformScaleToModel(false, vecPoint.X);
                    vecModelPoint.Y = chart.Axis(StandardAxis.PrimaryY).TransformScaleToModel(false, vecPoint.Y);
                    vecModelPoint.Z = chart.Axis(StandardAxis.Depth).TransformScaleToModel(false, vecPoint.Z);
                    break;
                }

                model3DToViewTransformation.Transform(vecModelPoint, ref viewPoint);

                // convert the view point to parent pixel coordinates
                watermark.TransformViewPointToParent(ref viewPoint);

                watermark.Location = new NPointL(
                    new NLength(viewPoint.X, NGraphicsUnit.Pixel),
                    new NLength(viewPoint.Y, NGraphicsUnit.Pixel));

                m_Parent.nChartControl1.RecalcLayout();
            }
Exemplo n.º 4
0
            public override void OnBeforePaint(NPanel panel, NPanelPaintEventArgs eventArgs)
            {
                NChart    chart      = panel as NChart;
                NRange1DD rulerRange = chart.Axis(StandardAxis.PrimaryY).Scale.RulerRange;

                NLabel label = new NLabel();

                label.Location                   = new NPointL(new NLength(100, NRelativeUnit.ParentPercentage), new NLength(0, NRelativeUnit.ParentPercentage));
                label.ContentAlignment           = ContentAlignment.BottomLeft;
                label.TextStyle.FontStyle.EmSize = new NLength(10);
                label.Text = " Min[" + rulerRange.Begin + "] Max[" + rulerRange.End + "]";

                chart.ChildPanels.Add(label);
                chart.RecalcLayout(eventArgs.Context);
            }
Exemplo n.º 5
0
            public override void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)
            {
                NGraphics graphics = eventArgs.Graphics;

                double     dPreviousValue, dCurrentValue;
                int        nBarCount = 10;
                NChart     chart     = panel as NChart;
                NBarSeries bar       = (NBarSeries)chart.Series[0];

                NAxis horzAxis = chart.Axis(StandardAxis.PrimaryX);
                NAxis vertAxis = chart.Axis(StandardAxis.PrimaryY);

                NVector3DF vecClientPoint = new NVector3DF();
                NVector3DF vecModelPoint  = new NVector3DF();

                int nBarSize = (int)(chart.ContentArea.Width * (int)bar.WidthPercent) / (nBarCount * 200);

                // init pens and brushes
                NStrokeStyle rectStrokeStyle = new NStrokeStyle(1, Color.DarkBlue);
                NFillStyle   rectFillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.FromArgb(125, Color.LightBlue), Color.FromArgb(125, Color.DarkBlue));

                NLightingImageFilter lightingFilter = new NLightingImageFilter();

                NStrokeStyle positiveArrowStrokeStyle = new NStrokeStyle(1, Color.DarkGreen);
                NFillStyle   positiveArrowFillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Green, Color.DarkGreen);

                positiveArrowFillStyle.ImageFiltersStyle.Filters.Add(lightingFilter);

                NStrokeStyle equalSignStrokeStyle = new NStrokeStyle(1, Color.DarkGray);
                NFillStyle   equalSignFillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Gray, Color.DarkGray);

                positiveArrowFillStyle.ImageFiltersStyle.Filters.Add(lightingFilter);

                NStrokeStyle negativeArrowStrokeStyle = new NStrokeStyle(1, Color.DarkRed);
                NFillStyle   negativeArrowFillStyle   = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.Red, Color.DarkRed);

                positiveArrowFillStyle.ImageFiltersStyle.Filters.Add(lightingFilter);

                for (int i = 1; i < bar.Values.Count; i++)
                {
                    dPreviousValue = (double)bar.Values[i - 1];
                    dCurrentValue  = (double)bar.Values[i];

                    vecModelPoint.X = horzAxis.TransformScaleToModel(false, i);
                    vecModelPoint.Y = vertAxis.TransformScaleToModel(false, (float)(double)bar.Values[i]);
                    vecModelPoint.Z = 0;

                    if (!chart.TransformModelToClient(vecModelPoint, ref vecClientPoint))
                    {
                        continue;
                    }

                    RectangleF rcArrowRect = new RectangleF(vecClientPoint.X - nBarSize, vecClientPoint.Y - nBarSize, 2 * nBarSize, 2 * nBarSize);

                    if (rcArrowRect.Width <= 0 || rcArrowRect.Height <= 0)
                    {
                        continue;
                    }

                    if (!DisplayMark(dCurrentValue, dPreviousValue))
                    {
                        continue;
                    }

                    // draw arrow background
                    GraphicsPath path = GetRoundRectanglePath(rcArrowRect);

                    graphics.PaintPath(rectFillStyle, rectStrokeStyle, path);

                    path.Dispose();

                    rcArrowRect.Inflate(-5, -5);

                    // draw the arrow itself
                    if (rcArrowRect.Width <= 0 || rcArrowRect.Height <= 0)
                    {
                        continue;
                    }

                    if (dCurrentValue < dPreviousValue)
                    {
                        // draw negative arrow
                        path = GetArrowPath(rcArrowRect, false);

                        graphics.PaintPath(negativeArrowFillStyle, negativeArrowStrokeStyle, path);

                        path.Dispose();
                    }
                    else if (dCurrentValue > dPreviousValue)
                    {
                        // draw positive arrow
                        path = GetArrowPath(rcArrowRect, true);

                        graphics.PaintPath(positiveArrowFillStyle, positiveArrowStrokeStyle, path);

                        path.Dispose();
                    }
                    else
                    {
                        // draw equal sign
                        NRectangleF rect = new NRectangleF(rcArrowRect.Left, rcArrowRect.Top, rcArrowRect.Width, rcArrowRect.Height / 3.0f);

                        graphics.PaintRectangle(equalSignFillStyle, equalSignStrokeStyle, rect);

                        rect = new NRectangleF(rcArrowRect.Left, rcArrowRect.Bottom - rect.Height, rcArrowRect.Width, rect.Height);

                        graphics.PaintRectangle(equalSignFillStyle, equalSignStrokeStyle, rect);
                    }
                }
            }
Exemplo n.º 6
0
 public void OnBeforePaint(NPanel panel, NPanelPaintEventArgs eventArgs)
 {
 }
Exemplo n.º 7
0
            public override void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)
            {
                Graphics graphics = eventArgs.Graphics.DeviceGraphics;

                double     dPreviousValue, dCurrentValue;
                int        nBarCount = 10;
                NChart     chart     = panel as NChart;
                NBarSeries bar       = (NBarSeries)chart.Series[0];

                NAxis horzAxis = chart.Axis(StandardAxis.PrimaryX);
                NAxis vertAxis = chart.Axis(StandardAxis.PrimaryY);

                NVector3DF vecClientPoint = new NVector3DF();
                NVector3DF vecModelPoint  = new NVector3DF();

                int nBarSize = (int)(chart.ContentArea.Width * (int)bar.WidthPercent) / (nBarCount * 200);

                // init pens and brushes
                Pen        penRectBorder = new Pen(Color.DarkBlue);
                SolidBrush brushRectFill = new SolidBrush(Color.FromArgb(125, Color.LightBlue));

                Pen        penPositiveArrowBorder = new Pen(Color.DarkGreen);
                SolidBrush brushPositiveArrowFill = new SolidBrush(Color.Green);

                Pen        penEqualSignBorder = new Pen(Color.DarkGray);
                SolidBrush brushEqualSignFill = new SolidBrush(Color.Gray);

                Pen        penNegativeArrowBorder = new Pen(Color.DarkRed);
                SolidBrush brushNegativeArrowFill = new SolidBrush(Color.Red);

                for (int i = 1; i < bar.Values.Count; i++)
                {
                    dPreviousValue = (double)bar.Values[i - 1];
                    dCurrentValue  = (double)bar.Values[i];

                    vecModelPoint.X = horzAxis.TransformScaleToModel(false, i);
                    vecModelPoint.Y = vertAxis.TransformScaleToModel(false, (float)(double)bar.Values[i]);
                    vecModelPoint.Z = 0;

                    if (!chart.TransformModelToClient(vecModelPoint, ref vecClientPoint))
                    {
                        continue;
                    }

                    RectangleF rcArrowRect = new RectangleF(vecClientPoint.X - nBarSize, vecClientPoint.Y - nBarSize, 2 * nBarSize, 2 * nBarSize);

                    if (rcArrowRect.Width <= 0 || rcArrowRect.Height <= 0)
                    {
                        continue;
                    }

                    if (!DisplayMark(dCurrentValue, dPreviousValue))
                    {
                        continue;
                    }

                    // draw arrow background
                    GraphicsPath path = GetRoundRectanglePath(rcArrowRect);

                    graphics.FillPath(brushRectFill, path);
                    graphics.DrawPath(penRectBorder, path);

                    path.Dispose();

                    rcArrowRect.Inflate(-5, -5);

                    // draw the arrow itself
                    if (rcArrowRect.Width <= 0 || rcArrowRect.Height <= 0)
                    {
                        continue;
                    }

                    if (dCurrentValue < dPreviousValue)
                    {
                        // draw negative arrow
                        path = GetArrowPath(rcArrowRect, false);

                        graphics.FillPath(brushNegativeArrowFill, path);
                        graphics.DrawPath(penNegativeArrowBorder, path);

                        path.Dispose();
                    }
                    else if (dCurrentValue > dPreviousValue)
                    {
                        // draw positive arrow
                        path = GetArrowPath(rcArrowRect, true);

                        graphics.FillPath(brushPositiveArrowFill, path);
                        graphics.DrawPath(penPositiveArrowBorder, path);

                        path.Dispose();
                    }
                    else
                    {
                        // draw equal sign
                        RectangleF rect = new RectangleF(rcArrowRect.Left, rcArrowRect.Top, rcArrowRect.Width, rcArrowRect.Height / 3.0f);

                        graphics.FillRectangle(brushEqualSignFill, rect.Left, rect.Top, rect.Width, rect.Height);
                        graphics.DrawRectangle(penEqualSignBorder, rect.Left, rect.Top, rect.Width, rect.Height);

                        rect = new RectangleF(rcArrowRect.Left, rcArrowRect.Bottom - rect.Height, rcArrowRect.Width, rect.Height);

                        graphics.FillRectangle(brushEqualSignFill, rect.Left, rect.Top, rect.Width, rect.Height);
                        graphics.DrawRectangle(penEqualSignBorder, rect.Left, rect.Top, rect.Width, rect.Height);
                    }
                }

                // dispose pens and brushes
                penPositiveArrowBorder.Dispose();
                brushPositiveArrowFill.Dispose();

                penNegativeArrowBorder.Dispose();
                brushNegativeArrowFill.Dispose();

                brushRectFill.Dispose();
                penRectBorder.Dispose();
            }
Exemplo n.º 8
0
 /// <summary>
 /// Occurs after the panel is painted.
 /// </summary>
 /// <param name="panel"></param>
 /// <param name="eventArgs"></param>
 public virtual void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)
 {
 }