private Image GenerateLineImage(ShapeLine line)
        {
            int w = line.VirtualBounds.Width / Zoom;
            int h = line.VirtualBounds.Height / Zoom;

            using (Image lineImg = new Bitmap(w == 0 ? 1 : w, h == 0 ? 1 : h))
                using (Graphics gh = Graphics.FromImage(lineImg))
                    using (var pen = ResourceCache.DefaultCache.GetPen(line.DrawingColor, line.BorderWidth, PenAlignment.Inset, line.LineDashStyle))
                    {
                        gh.Clear(Color.Transparent);
                        gh.DrawLine(pen, line.RelationStart, line.RelationEnd);
                        return(line.FormatImage(lineImg, line.VirtualBounds));
                    }
        }
        public void VisitLine(ShapeLine line)
        {
            int   w         = line.BorderWidth * Zoom;
            Color drawColor = line.BorderColor;

            if (drawColor == Color.Black)
            {
                drawColor = Color.FromArgb(255, 1, 255, 1);
            }

            using (Image tmpimg = GenerateLineImage(line))
            {
                InterpolationMode oldmode = Graphics.InterpolationMode;
                Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
                Graphics.DrawImage(tmpimg, line.VirtualBounds, 0, 0, tmpimg.Width, tmpimg.Height, GraphicsUnit.Pixel);
                Graphics.InterpolationMode = oldmode;
            }
        }