PurplePen.LineCourseObj.Highlight C# (CSharp) Method

Highlight() public method

public Highlight ( Graphics g, Matrix xformWorldToPixel, Brush brush, bool erasing ) : void
g System.Drawing.Graphics
xformWorldToPixel Matrix
brush System.Drawing.Brush
erasing bool
return void
        public override void Highlight(Graphics g, Matrix xformWorldToPixel, Brush brush, bool erasing)
        {
            GDIPlus_GraphicsTarget grTarget = new GDIPlus_GraphicsTarget(g);

               object brushKey = new object();
               grTarget.CreateGdiPlusBrush(brushKey, brush, false);

               // Get thickness of line.
               float pixelThickness = TransformDistance(thickness * scaleRatio, xformWorldToPixel);

               SymPath[] gappedPaths = LegGap.SplitPathWithGaps(path, gaps);

               // Draw it.
               object penKey = new object();
               grTarget.CreatePen(penKey, brushKey, pixelThickness, LineCap.Flat, LineJoin.Miter, 5);

               try {
               foreach (SymPath p in gappedPaths) {
                   p.DrawTransformed(grTarget, penKey, xformWorldToPixel);
               }
               }
               catch (ExternalException) {
               // Ignore this exeption. Not sure what causes it.
               }

               grTarget.Dispose();
        }