コード例 #1
0
ファイル: CourseObject.cs プロジェクト: petergolde/PurplePen
        public override void Highlight(Graphics g, Matrix xformWorldToPixel, Brush brush, bool erasing)
        {
            SymPath path1, path2, path3, path4;
            float thickness;

            GDIPlus_GraphicsTarget grTarget = new GDIPlus_GraphicsTarget(g);

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

            // Get line thickness.
            thickness = TransformDistance(NormalCourseAppearance.lineThickness * scaleRatio * appearance.lineWidth, xformWorldToPixel);

            // Get the paths.
            path1 = new SymPath(OffsetCoords(ScaleCoords((PointF[]) coords1.Clone()), location.X, location.Y), kinds1);
            path2 = new SymPath(OffsetCoords(ScaleCoords((PointF[]) coords2.Clone()), location.X, location.Y), kinds2);
            path3 = new SymPath(OffsetCoords(ScaleCoords((PointF[]) coords3.Clone()), location.X, location.Y), kinds3);
            path4 = new SymPath(OffsetCoords(ScaleCoords((PointF[]) coords4.Clone()), location.X, location.Y), kinds4);

            object penKey = new object();
            grTarget.CreatePen(penKey, brushKey, thickness, LineCap.Round, LineJoin.Miter, 5);

            // Draw the paths
            path1.DrawTransformed(grTarget, penKey, xformWorldToPixel);
            path2.DrawTransformed(grTarget, penKey, xformWorldToPixel);
            path3.DrawTransformed(grTarget, penKey, xformWorldToPixel);
            path4.DrawTransformed(grTarget, penKey, xformWorldToPixel);

            grTarget.Dispose();
        }