protected override void DrawPoint(Settings settings, List <PointF> points, int i)
        {
            // always draw the underlying point
            base.DrawPoint(settings, points, i);

            // if highlighted, draw the highlight marker on top of it
            if (isHighlighted[i])
            {
                MarkerTools.DrawMarker(settings.gfxData, points[i], highlightedShape, highlightedMarkerSize, highlightedColor);
            }
        }
Ejemplo n.º 2
0
        private void RenderOnBitmap(Graphics gfx, LegendItem[] items, Font font,
                                    float locationX, float locationY, float width, float height, float maxLabelHeight,
                                    bool shadow = true, bool fill = true, bool outline = true)
        {
            using (var fillBrush = new SolidBrush(FillColor))
                using (var shadowBrush = new SolidBrush(ShadowColor))
                    using (var textBrush = new SolidBrush(FontColor))
                        using (var outlinePen = new Pen(OutlineColor))
                        {
                            if (AntiAlias)
                            {
                                gfx.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                                gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                            }

                            RectangleF rectShadow = new RectangleF(locationX + ShadowOffsetX, locationY + ShadowOffsetY, width, height);
                            RectangleF rectFill   = new RectangleF(locationX, locationY, width, height);

                            if (shadow)
                            {
                                gfx.FillRectangle(shadowBrush, rectShadow);
                            }

                            gfx.FillRectangle(fillBrush, rectFill);

                            if (outline)
                            {
                                gfx.DrawRectangle(outlinePen, Rectangle.Round(rectFill));
                            }

                            for (int i = 0; i < items.Length; i++)
                            {
                                var   item           = items[i];
                                float verticalOffset = i * maxLabelHeight;

                                // draw text
                                gfx.DrawString(item.label, font, textBrush, locationX + symbolWidth, locationY + verticalOffset);

                                // draw line
                                outlinePen.Color = item.colour;
                                outlinePen.Width = 1;
                                float lineY  = locationY + verticalOffset + maxLabelHeight / 2;
                                float lineX1 = locationX + symbolPad;
                                float lineX2 = lineX1 + symbolWidth - symbolPad * 2;
                                using (var linePen = GDI.Pen(item.colour, item.lineWidth, item.lineStyle, false))
                                    gfx.DrawLine(linePen, lineX1, lineY, lineX2, lineY);

                                // draw marker
                                float  lineXcenter = (lineX1 + lineX2) / 2;
                                PointF markerPoint = new PointF(lineXcenter, lineY);
                                MarkerTools.DrawMarker(gfx, markerPoint, item.markerShape, markerWidth, item.colour);
                            }
                        }
        }
 protected virtual void DrawPoint(Settings settings, List <PointF> points, int i)
 {
     MarkerTools.DrawMarker(settings.gfxData, points[i], markerShape, markerSize, color);
 }