Esempio n. 1
0
        private static void DrawBounds(Graphics graphics, Pen pen, Brush brush, Brush textBrush, Font font, string text, LeadRectD bounds, LeadMatrix transform)
        {
            var corners = Tools.GetCornerPoints(bounds);

            transform.TransformPoints(corners);
            var cornersBounds = Tools.GetBoundingRect(corners);

            var cornersF = new PointF[4];

            for (var i = 0; i < cornersF.Length; i++)
            {
                // if any point empty, then return
                if (corners[i].IsEmpty)
                {
                    return;
                }

                cornersF[i] = new PointF((float)corners[i].X, (float)corners[i].Y);
            }

            if (pen != null)
            {
                graphics.DrawPolygon(pen, cornersF);
            }
            if (brush != null)
            {
                graphics.FillPolygon(brush, cornersF);
            }
            if (text != null && textBrush != null)
            {
                graphics.DrawString(text, font, textBrush, (float)cornersBounds.X, (float)cornersBounds.Y);
            }
        }
Esempio n. 2
0
        public LeadPointD ConvertPoint(CoordinateType source, CoordinateType destination, LeadPointD point)
        {
            if (source == destination)
            {
                return(point);
            }

            LeadPointD[] points = { point };

            if (source == CoordinateType.Control)
            {
                _transformInverse.TransformPoints(points);
            }
            else
            {
                _transform.TransformPoints(points);
            }

            return(points[0]);
        }