コード例 #1
0
        public void RenderRoundedRectangle(Rect rectangle, Brush foreground, Brush background, double radX, double radY)
        {
            Rect scaledRectangle = GeometryHelper.ScaleRectangle(_scale, rectangle);
            Pen  rectpen         = new Pen(foreground, 1.2);

            _drawingContext.DrawRoundedRectangle(background, rectpen, scaledRectangle, radX, radY);
        }
コード例 #2
0
        /// <summary>
        /// Renders an image to the <see cref="GeometryGroup"/>.
        /// </summary>
        /// <param name="rectangle"></param>
        /// <param name="imagesrc"></param>
        public void RenderImage(Rect rectangle, string imagesrc)
        {
            var scaledImg = GeometryHelper.ScaleRectangle(_scale, rectangle);

            ImageSource img = new BitmapImage(new Uri(imagesrc));

            _drawingContext.DrawImage(img, scaledImg);
        }
コード例 #3
0
        public void RenderRoundedRectangle(Rect rectangle, Brush foreground, Brush background, double radX, double radY)
        {
            Rect scaledRectangle        = GeometryHelper.ScaleRectangle(_scale, rectangle);
            Pen  rectpen                = new Pen(foreground, 0.8);
            var  roundrectangleGeometry = new RectangleGeometry(scaledRectangle, radX, radY);

            _geometry.Children.Add(roundrectangleGeometry);
        }
コード例 #4
0
        public void RenderRectangle(Rect rectangle, Brush foreground, Brush background, double rotationAngle = 0)
        {
            var rectangleGeometry = new RectangleGeometry(GeometryHelper.ScaleRectangle(_scale, rectangle))
            {
                Transform = new RotateTransform(rotationAngle)
            };

            _geometry.Children.Add(rectangleGeometry);
        }
コード例 #5
0
        public void RenderEllipse(Rect rectangle, Brush foreground, Brush background)
        {
            var scaledEllipse = GeometryHelper.ScaleRectangle(_scale, rectangle);
            var cPt           = new Point(scaledEllipse.X + (scaledEllipse.Width / 2), scaledEllipse.Y + (scaledEllipse.Height / 2));
            Pen ellpen        = new Pen(foreground, 1);
            var radius_X      = scaledEllipse.Width / 2;
            var radius_Y      = scaledEllipse.Height / 2;

            _drawingContext.DrawEllipse(background, ellpen, cPt, radius_X, radius_Y);
        }
コード例 #6
0
        /// <summary>
        /// Renders a rectangle(an image isn't a geometry) to the <see cref="GeometryGroup"/>.
        /// </summary>
        /// <param name="rectangle"></param>
        /// <param name="imagesrc"></param>
        public void RenderImage(Rect rectangle, string imagesrc)
        {
            var rectangleGeometry = new RectangleGeometry(GeometryHelper.ScaleRectangle(_scale, rectangle));

            ImageBrush      imgbrs = new ImageBrush();
            Rectangle       ty     = new Rectangle();
            GeometryDrawing geodrw = new GeometryDrawing(imgbrs, null, rectangleGeometry);

            _geometry.Children.Add(rectangleGeometry);
        }
コード例 #7
0
        public void RenderRectangle(Rect rectangle, Brush foreground, Brush background, double rotationAngle = 0)
        {
            var scaledRectangle = GeometryHelper.ScaleRectangle(_scale, rectangle);
            var rectGeom        = new RectangleGeometry(scaledRectangle);
            Pen rectpen         = new Pen(foreground, 0.8);

            if (background == null)
            {
                _drawingContext.DrawRectangle(foreground, null, scaledRectangle);
            }
            else
            {
                _drawingContext.DrawGeometry(background, rectpen, rectGeom);
            }
        }
コード例 #8
0
        public void RenderElement(Box box, double x, double y)
        {
            var guidelines = GenerateGuidelines(box, x, y);

            _drawingContext.PushGuidelineSet(guidelines);

            RenderBackground(box, x, y);
            box.RenderTo(this, x, y);

            if (box.ShowBounds == true)
            {
                Pen boundspen = new Pen(Brushes.Black, 1.2)
                {
                    DashStyle = new DashStyle(new double[] { 2.3, 2.3 }, 0.25),
                };
                var boxrect = GeometryHelper.ScaleRectangle(_scale, new Rect(x, (y - box.Height), box.TotalWidth, box.TotalHeight));
                _drawingContext.DrawRectangle(null, boundspen, boxrect);
            }

            _drawingContext.Pop();
        }
コード例 #9
0
        public void RenderRectangle(Rect rectangle, Brush foreground)
        {
            var scaledRectangle = GeometryHelper.ScaleRectangle(_scale, rectangle);

            _foregroundContext.DrawRectangle(foreground, null, scaledRectangle);
        }
コード例 #10
0
        public void RenderRectangle(Rect rectangle, Brush foreground)
        {
            var rectangleGeometry = new RectangleGeometry(GeometryHelper.ScaleRectangle(_scale, rectangle));

            _geometry.Children.Add(rectangleGeometry);
        }
コード例 #11
0
        /// <summary>
        /// Renders an ellipse to the <see cref="GeometryGroup"/>.
        /// </summary>
        /// <param name="rectangle"></param>
        /// <param name="foreground"></param>
        public void RenderEllipse(Rect rectangle, Brush foreground, Brush background)
        {
            var ellipseGeometry = new EllipseGeometry(GeometryHelper.ScaleRectangle(_scale, rectangle));

            _geometry.Children.Add(ellipseGeometry);
        }