Exemple #1
0
        private void DrawBorders(System.Windows.Media.DrawingContext dc)
        {
            dc.PushClip(new RectangleGeometry(new Rect(0, 0, Width, Height)));

            int lineNumber = StartLine;

            if (lineNumber > 0)
            {
                lineNumber--;
            }
            while (lineNumber > 0 && !REPLData.KindIsGap(LineKinds[lineNumber]))
            {
                lineNumber--;
            }
            while (true)
            {
                double topY = (lineNumber - StartLine) * LineHeight + 2;
                lineNumber++;
                while (lineNumber < Lines.Count && !REPLData.KindIsGap(LineKinds[lineNumber]))
                {
                    lineNumber++;
                }
                double bottomY = (lineNumber - StartLine) * LineHeight + 2;
                dc.DrawRoundedRectangle(InsideBrush, BorderPen, new Rect(SpaceWidth / 2, topY + topOffset, Width - SpaceWidth, bottomY - topY - LineHeight / 3), SpaceWidth, SpaceWidth);
                if (lineNumber >= Lines.Count - 1 || lineNumber > StartLine + Height / LineHeight)
                {
                    break;
                }
            }
            ;
            dc.Pop();
        }
        protected override void OnRender(DrawingContext drawingContext)
        {
            var visualTargetItem = DropInfo.VisualTargetItem;
            if (visualTargetItem != null)
            {
                var rect = Rect.Empty;

                var tvItem = visualTargetItem as TreeViewItem;
                if (tvItem != null && VisualTreeHelper.GetChildrenCount(tvItem) > 0)
                {
                    var descendant = VisualTreeHelper.GetDescendantBounds(tvItem);
                    var translatePoint = tvItem.TranslatePoint(new Point(), AdornedElement);
                    var itemRect = new Rect(translatePoint, tvItem.RenderSize);
                    descendant.Union(itemRect);
                    rect = new Rect(translatePoint, new Size(descendant.Width - translatePoint.X, tvItem.ActualHeight));
                }
                if (rect.IsEmpty)
                {
                    rect = new Rect(visualTargetItem.TranslatePoint(new Point(), AdornedElement),
                        VisualTreeHelper.GetDescendantBounds(visualTargetItem).Size);
                }
                var color = (Color) ThemeManager.DetectAppStyle(Application.Current).Item2.Resources["AccentColor"];
                drawingContext.DrawRoundedRectangle(null, new Pen(new SolidColorBrush(color), 2), rect, 2, 2);
            }
        }
        private void DrawBackgroundBlock( DrawingContext ctx )
        {
            var pen = new Pen( Brushes.DarkOliveGreen, 1 );
            var rect = new Rect( 20, 60, 200, 50 );
            ctx.DrawRoundedRectangle( Brushes.DarkOliveGreen, pen, rect, 50, 50 );

            Log( "background block" );
        }
        private void DrawBackground( DrawingContext ctx )
        {
            var pen = new Pen( Brushes.Black, 1 );
            var rect = new Rect( 0, 0, m_layers.ActualWidth, m_layers.ActualHeight );
            ctx.DrawRoundedRectangle( Brushes.Black, pen, rect, 50, 50 );

            Log( "background" );
        }
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     if (_image != null)
     {
         ImageTranslucent profileImage = Visual as ImageTranslucent;
         drawingContext.DrawRoundedRectangle(_imageBrush, _borderPen, _imageRect, profileImage.CornerRadius, profileImage.CornerRadius);
     }
 }
Exemple #6
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            Rect adornedElementRect = new Rect(this.AdornedElement.DesiredSize);

            drawingContext.DrawRectangle(null, _borderPen, adornedElementRect);
            drawingContext.DrawRoundedRectangle(Brushes.White, _borderPen,
                    new Rect(adornedElementRect.X + (adornedElementRect.Width / 2d) - 7d, adornedElementRect.Y + (adornedElementRect.Height / 2d) - 7d, 14d, 14d), 2d, 2d);
            _textFormat.RenderText(drawingContext, Brushes.Black, _label, adornedElementRect);
        }
 protected override void OnRender(DrawingContext drawingContext, double scaleX, double scaleY)
 {
     if (_image != null)
     {
         ImageDecoration profileImage = Visual as ImageDecoration;
         Rect scaledRect = new Rect(_imageRect.X, _imageRect.Y, _imageRect.Width * scaleX, _imageRect.Height * scaleY);
         drawingContext.DrawRoundedRectangle(_imageBrush, _borderPen, scaledRect, profileImage.CornerRadius, profileImage.CornerRadius);
     }            
 }
 protected override void OnRender(DrawingContext dc)
 {
     RadialGradientBrush brush = new RadialGradientBrush(
         IsPressed ? SystemColors.ControlDarkColor : SystemColors.ControlLightLightColor,
         SystemColors.ControlColor);
     brush.GradientOrigin = IsPressed ? new Point(0.75, 0.75) : new Point(0.25, 0.25);
     dc.DrawRoundedRectangle(brush, new Pen(SystemColors.ControlDarkDarkBrush, 1),
         new Rect(new Point(0, 0), RenderSize), RenderSize.Height/2, RenderSize.Height/2);
 }
Exemple #9
0
 protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
 {
     if (_image != null)
     {
         KneeBoard profileImage = Visual as KneeBoard;
         OnRefresh();
         drawingContext.DrawRoundedRectangle(_imageBrush, _borderPen, _imageRect, 0, 0);
     }
 }
 /// <summary>
 /// Render.
 /// </summary>
 /// <param name="drawingContext"></param>
 protected override void OnRender(DrawingContext drawingContext)
 {
     if (DropInfo.VisualTargetItem != null)
     {
         Rect rect = new Rect(
             DropInfo.VisualTargetItem.TranslatePoint(new Point(), AdornedElement),
             VisualTreeHelper.GetDescendantBounds(DropInfo.VisualTargetItem).Size);
         drawingContext.DrawRoundedRectangle(null, new Pen(Brushes.Gray, 2), rect, 2, 2);
     }
 }
    protected override void OnRender(DrawingContext drawingContext)
    {
      if (DropInfo.VisualTargetItem == null)
        return;

      var location = DropInfo.VisualTargetItem.TranslatePoint(new Point(), AdornedElement);
      var size = VisualTreeHelper.GetDescendantBounds(DropInfo.VisualTargetItem).Size;

      var rect = new Rect(location, size);
      drawingContext.DrawRoundedRectangle(null, new Pen(Brushes.Gray, 2), rect, 2, 2);
    }
Exemple #12
0
        public static void DrawText(System.Windows.Media.DrawingContext dc, FormattedText text, double x, double y, bool background = true)
        {
            System.Windows.Media.Brush brush = new SolidColorBrush(
                System.Windows.Media.Color.FromArgb(190, 255, 255, 255));
            int pad = 1;

            //Draw semi transparent rectangle behind text
            Rect size = new Rect(x - pad, y - pad, text.Width + 2 * pad, text.Height + 2 * pad);

            dc.DrawRoundedRectangle(brush, new System.Windows.Media.Pen(brush, 0), size, pad, pad);
            dc.DrawText(text, new System.Windows.Point(x, y));
        }
        protected override void ApplyFilter(FastBitmap source, DrawingContext dc, int width, int height)
        {
            // Draw image.
            dc.PushTransform(new TranslateTransform(BorderWidth, BorderWidth));
            dc.DrawImage(source.InnerBitmap, new Rect(0, 0, source.Width, source.Height));
            dc.Pop();

            // Draw border.
            dc.DrawRoundedRectangle(null, new Pen(new SolidColorBrush(BorderColor), BorderWidth),
                new Rect(BorderWidth / 2.0, BorderWidth / 2.0, width - BorderWidth, height - BorderWidth),
                Roundness, Roundness);
        }
        protected override void OnRender(DrawingContext dc)
        {
            var offX = 0;
            var offY = 0;
            var width = ActualWidth;
            var height = ActualHeight;

            var brush = BorderBackground;
            var pen = new Pen(brush, 1);
            pen.Freeze();
            var rect = new Rect(offX, offY, width, height);

            dc.DrawRoundedRectangle(brush, pen, rect, CornerRadius, CornerRadius);
            base.OnRender(dc);
        }
        protected override void OnRender(DrawingContext drawingContext)
        {
            var visualTargetItem = this.DropInfo.VisualTargetItem;
              if (visualTargetItem != null) {
            var rect = Rect.Empty;

            var tvItem = visualTargetItem as TreeViewItem;
            if (tvItem != null && VisualTreeHelper.GetChildrenCount(tvItem) > 0) {
              var descendant = VisualTreeHelper.GetDescendantBounds(tvItem);
              rect = new Rect(tvItem.TranslatePoint(new Point(), this.AdornedElement), new Size(descendant.Width + 4, tvItem.ActualHeight));
            }
            if (rect.IsEmpty) {
              rect = new Rect(visualTargetItem.TranslatePoint(new Point(), this.AdornedElement), VisualTreeHelper.GetDescendantBounds(visualTargetItem).Size);
            }
            drawingContext.DrawRoundedRectangle(null, new Pen(Brushes.Gray, 2), rect, 2, 2);
              }
        }
 public void Draw(TextView textView, DrawingContext drawingContext)
 {
     textView.EnsureVisualLines();
     if (_line.IsDeleted) return;
     var segment = new TextSegment
     {
         StartOffset = _line.Offset,
         EndOffset = _line.EndOffset
     };
     // ReSharper disable once RedundantArgumentDefaultValue
     foreach (var current in BackgroundGeometryBuilder.GetRectsForSegment(textView, segment, false))
     {
         drawingContext.DrawRoundedRectangle(new SolidColorBrush(EditorOptions.Instance.HighlightedLineColor),
             new Pen(Brushes.Red, 0.0),
             new Rect(current.Location, new Size(textView.ActualWidth, current.Height)), 3.0, 3.0);
     }
 }
        public void Draw(TextView textView, DrawingContext ctx)
        {
            if (line == null)
                return;

            foreach(var color in colors)
            {
                var from = GetPositionFromOffset(tab.Editor, VisualYPosition.LineTop, line.Offset + color.Match.Index);
                var to = GetPositionFromOffset(tab.Editor, VisualYPosition.LineTop, line.Offset + color.Match.Index + color.Match.Length);

                var x = from.X - tab.Editor.TextArea.TextView.ScrollOffset.X - 3;
                var y = from.Y - 18 - tab.Editor.TextArea.TextView.ScrollOffset.Y;
                var width = to.X - from.X + 12;
                var height = 16;

                ctx.DrawRoundedRectangle(new SolidColorBrush(color.Color), new Pen(), new Rect(x, y, width, height), 3, 3);
            }
        }
        public void Draw(TextView textView, DrawingContext drawingContext)
        {
            textView.EnsureVisualLines();

            #region Highlight Current Line

            if(lastLine != _editor.TextArea.Caret.Line) {
                var line = _editor.Document.GetLineByOffset(_editor.CaretOffset);
                var segment = new TextSegment { StartOffset = line.Offset, EndOffset = line.EndOffset };
                foreach(Rect r in BackgroundGeometryBuilder.GetRectsForSegment(textView, segment)) {
                    drawingContext.DrawRoundedRectangle(_lineSelection, _borderPen, new Rect(r.Location, new Size(textView.ActualWidth, r.Height)), 3, 3);
                }
            }

            #endregion

            #region Highlight Brackets

            if(_editor.TextArea.Caret.Offset > 1 && TokenHelper.BRAKETS.ContainsKey(_editor.TextArea.Document.GetCharAt(_editor.TextArea.Caret.Offset - 1))) {
                var offset = _editor.TextArea.Caret.Offset;
                var seg = _projectitem.SegmentService.QueryCodeSegmentAt(offset);
                if(seg != null && TokenHelper.BRAKETS.ContainsValue(seg.Token)) {
                    var other = seg.FindOtherBracked(true);

                    var col = other != null ? _braketMatch : _braketMatchFail;
                    var braketsegment = new TextSegment { StartOffset = seg.Range.Offset, EndOffset = seg.Range.EndOffset };
                    foreach(Rect r in BackgroundGeometryBuilder.GetRectsForSegment(textView, braketsegment)) {
                        drawingContext.DrawRectangle(col, _borderPen, r);
                    }

                    if(other != null) {
                        braketsegment = new TextSegment { StartOffset = other.Range.Offset, EndOffset = other.Range.EndOffset };
                        foreach(Rect r in BackgroundGeometryBuilder.GetRectsForSegment(textView, braketsegment)) {
                            drawingContext.DrawRectangle(_braketMatch, _borderPen, r);
                        }
                    }
                }
            }

            #endregion
        }
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            Rect bounds = new Rect(0, 0, Width, Height);
            Pen  pen    = new Pen(Brushes.Green, 4);

            drawingContext.DrawRoundedRectangle(Brushes.Yellow, pen, bounds, 5, 5);


            string   ImagePawnString = ("M35.54,35.2H14.46A.64.64,0,0,1,14,35a.66.66,0,0,1-.13-.51,11.4,11.4,0,0,1,5.27-7.72,7.43,7.43,0,1,1,11.76,0,11.4,11.4,0,0,1,5.27,7.72A.66.66,0,0,1,36,35,.64.64,0,0,1,35.54,35.2ZM15.23,34H34.77a10.13,10.13,0,0,0-5.15-6.47A.62.62,0,0,1,29.3,27a.61.61,0,0,1,.16-.53,6.18,6.18,0,1,0-8.92,0,.61.61,0,0,1,.16.53.62.62,0,0,1-.32.46A10.13,10.13,0,0,0,15.23,34Z");
            Geometry ImagePawn       = Geometry.Parse(ImagePawnString);


            //Rect boundsGeometry = new Rect(100, 100, 80, 80);
            Pen penGeometry = new Pen(Brushes.Orange, 2);

            drawingContext.DrawGeometry(Brushes.Pink, pen, ImagePawn);



            this.Height = 100;
            this.Width  = 80;
        }
Exemple #20
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            Rect adornedElementRect = new Rect(this.AdornedElement.RenderSize);
            
            //Point relativePoint = this.AdornedElement.TransformToAncestor(Application.Current.MainWindow).Transform(new Point(0, 0));
            adornedElementRect.Location = new Point(adornedElementRect.Location.X, adornedElementRect.Location.Y + adornedElementRect.Height + 10);            

            // Some arbitrary drawing implements.
            SolidColorBrush renderBrush = new SolidColorBrush(Color.FromRgb(0, 107,194));            
            Pen renderPen = new Pen(new SolidColorBrush(Colors.Navy), 1.5);                    
            
            drawingContext.DrawRoundedRectangle(renderBrush, null, adornedElementRect, 0.0, 0.0);

            

            //drawingContext.DrawImage()
            //drawingContext.DrawGeometry()
            var text = new FormattedText("Navigate between Triggers, Logs and the home screen.", CultureInfo.InvariantCulture, System.Windows.FlowDirection.LeftToRight, new Typeface("Segoe UI"), 16, Brushes.White);
            drawingContext.DrawText(text, new Point(adornedElementRect.Location.X, adornedElementRect.Location.Y));


        }
        public static bool DrawInscribedRoundedRect(DrawingContext drawingContext, Brush fill, Pen stroke, Rect outerBounds, double cornerRadius)
        {
            Point spineLeftTop = new Point(outerBounds.Left, outerBounds.Top);
            Point spineRightBottom = new Point(outerBounds.Right, outerBounds.Bottom);
            bool drewSomething = false;

            if (stroke != null && !Tolerances.NearZero(stroke.Thickness))
            {
                double halfThickness = stroke.Thickness / 2d;
                spineLeftTop.X += halfThickness;
                spineLeftTop.Y += halfThickness;
                spineRightBottom.X -= halfThickness;
                spineRightBottom.Y -= halfThickness;
            }

            Rect spineRect = new Rect(spineLeftTop, spineRightBottom);
            if (!Tolerances.NearZero(spineRect.Width) && !Tolerances.NearZero(spineRect.Height))
            {
                drawingContext.DrawRoundedRectangle(fill, stroke, spineRect, cornerRadius, cornerRadius);
                drewSomething = true;
            }

            return drewSomething;
        }
        private void drawHands(DrawingContext drawingContext, ThreeDAuth.DepthPoint hand, bool drawHand, DepthImageFrame depthFrame)
        {
            //showDepthView(depthFrame, drawingContext);
            //return;

            //Start Siavash

            double resetButtonTimePercentage = 0.0;
            double doneButtonTimePercentage = 0.0;
            if (userImage != null)
            {
                drawingContext.DrawImage(userImage, new Rect(0.0, 0.0, RenderWidth, RenderHeight));

                // Draw the reset button regardless
                //Pen buttonPen = new Pen(Brushes.Black, 0.1);
                //Brush resetButtonBrush = new SolidColorBrush(Color.FromRgb());
                //drawingContext
                if (resetButtonTimer.IsRunning)
                {
                    resetButtonTimePercentage = (double) resetButtonTimer.ElapsedMilliseconds / (double) BUTTON_HOLD_CUTOFF;
                }
                if (resetButtonTimePercentage > 1.0)
                {
                    drawingContext.DrawEllipse(Brushes.Green, null, new System.Windows.Point(0, 0), 50, 50);
                    resetButtonTimePercentage = 1.0;
                }
                else
                {
                    drawingContext.DrawEllipse(Brushes.White, null, new System.Windows.Point(0, 0), 50, 50);
                }

                DrawWedge(drawingContext, 0, 0, SweepDirection.Counterclockwise, resetButtonTimePercentage);
                drawingContext.DrawText(
                    new FormattedText("Reset",
                                      System.Globalization.CultureInfo.CurrentCulture,
                                      FlowDirection.LeftToRight,
                                      new Typeface("Arial"),
                                      14.0,
                                      Brushes.Black),
                    new System.Windows.Point(3, 12.5));

                // Draw the done button if we're learning
                if (gLearner.isRecording)
                {
                    if (doneButtonTimer.IsRunning)
                    {
                        doneButtonTimePercentage = (double)doneButtonTimer.ElapsedMilliseconds / (double)BUTTON_HOLD_CUTOFF;
                    }
                    if (doneButtonTimePercentage > 1.0) doneButtonTimePercentage = 1.0;
                    drawingContext.DrawEllipse(Brushes.White, null, new System.Windows.Point(depthFrame.Width, 0), 50, 50);
                    DrawWedge(drawingContext, depthFrame.Width, 0, SweepDirection.Clockwise, doneButtonTimePercentage);
                    drawingContext.DrawText(
                        new FormattedText("Done",
                                          System.Globalization.CultureInfo.CurrentCulture,
                                          FlowDirection.LeftToRight,
                                          new Typeface("Arial"),
                                          14.0,
                                          Brushes.Black),
                        new System.Windows.Point(depthFrame.Width - 35.0, 12.5));
                }
            }

            //End Siavash
            drawHand = true;
            if (drawHand)
            {
                if (myFrame.AvgTorsoPosition != null)
                //if (myFrame.torsoPosition != null)
                {
                    // Anton's code
                    // when a new frame is available, we check if the wrists are crossing the plane and we draw an appropriately colored
                    // rectangle over them to give the user feedback
                    double planeDepth = myFrame.armLength * .8;
                    int planeDepthPixels = (int)((planeDepth / myFrame.armLength) * myFrame.AvgArmLengthPixels);
                    //ThreeDAuth.FlatPlane myPlane = new ThreeDAuth.FlatPlane(myFrame.torsoPosition, planeDepth);
                    ThreeDAuth.FlatPlane myPlane = new ThreeDAuth.FlatPlane(myFrame.AvgTorsoPosition, planeDepth);
                    //Console.WriteLine("Torso depth: " + torsoSkeletonPoint.Z);
                    //ThreeDAuth.Point3d wristRight = new ThreeDAuth.Point3d(rightWrist.Position.X, rightWrist.Position.Y, rightWrist.Position.Z);

                    //ThreeDAuth.DepthPoint right = this.SkeletonPointToScreen(rightWrist.Position);

                    //ThreeDAuth.PlanePoint arrived = new ThreeDAuth.PlanePoint(right.x, right.y, myPlane.crossesPlane(right));

                    //pDistributor.GivePoint(arrived);
                    //Console.WriteLine("Depth: " + hand.depth);

                    short planeDepthmm = (short)(planeDepth * 1000); // convert m to mm
                    Tuple<int, int> handTuple = new Tuple<int, int>(hand.x, hand.y);
                    handTuple = ProjectPoint(handTuple,
                                             myFrame.AvgTorsoPosition,
                                             myFrame.AvgArmLengthPixels,
                                             planeDepthPixels,
                                             .9,
                                             depthFrame.Width,
                                             depthFrame.Height);
                    if (handTuple == null)
                    {
                        // encountered a problem and won't be able to project this point, so drop this frame
                        return;
                    }

                    ThreeDAuth.PlanePoint planePoint = new ThreeDAuth.PlanePoint(handTuple.Item1, handTuple.Item2, myPlane.crossesPlane(hand));
                    //ThreeDAuth.PlanePoint planePoint = new ThreeDAuth.PlanePoint(hand.x, hand.y, myPlane.crossesPlane(hand));
                    pDistributor.GivePoint(planePoint);

                    //drawingContext.DrawRoundedRectangle(Brushes.Green, null, new Rect(hand.x, hand.y, 30, 30), null, 14, null, 14, null);

                    // Check if the point is in the buttons

                    // reset button
                    bool inButton = false;
                    if (Math.Sqrt((planePoint.x * planePoint.x) + (planePoint.y * planePoint.y)) < 50.0)
                    {
                        // in reset button
                        inButton = true;
                        if (!resetButtonTimer.IsRunning)
                        {
                            resetButtonTimer.Start();

                        }
                    }
                    else
                    {
                        if (resetButtonTimer.IsRunning)
                        {

                            resetButtonTimer.Reset();

                        }
                    }

                    // done button
                    if (gLearner.isRecording)
                    {
                        if (Math.Sqrt(((planePoint.x - depthFrame.Width) * (planePoint.x - depthFrame.Width)) +
                                      (planePoint.y * planePoint.y)) < 50.0)
                        {
                            // in done button
                            inButton = true;
                            if (!doneButtonTimer.IsRunning)
                            {

                                doneButtonTimer.Start();
                            }
                        }
                        else
                        {
                            if (doneButtonTimer.IsRunning)
                            {
                                doneButtonTimer.Reset();
                            }
                        }
                    }

                    //drawingContext.DrawRoundedRectangle(Brushes.Yellow, null, new Rect(hand.x, hand.y, 30, 30), null, 14, null, 14, null);

                    //if (arrived.inPlane)
                    if (planePoint.inPlane)
                    {
                        //drawingContext.DrawRoundedRectangle(Brushes.Blue, null, new Rect(right.x, right.y, 30, 30), null, 14, null, 14, null);
                        //drawingContext.DrawRoundedRectangle(Brushes.Blue, null, new Rect(hand.x, hand.y, 30, 30), null, 14, null, 14, null);
                        drawingContext.DrawRoundedRectangle(Brushes.Blue, null, new Rect(planePoint.x, planePoint.y, 30, 30), null, 14, null, 14, null);
                    }
                    else
                    {
                        //drawingContext.DrawRoundedRectangle(Brushes.Red, null, new Rect(right.x, right.y, 30, 30), null, 14, null, 14, null);
                        //drawingContext.DrawRoundedRectangle(Brushes.Red, null, new Rect(hand.x, hand.y, 30, 30), null, 14, null, 14, null);
                        drawingContext.DrawRoundedRectangle(Brushes.Red, null, new Rect(planePoint.x, planePoint.y, 30, 30), null, 14, null, 14, null);
                    }

                    ThreeDAuth.Point3d wristLeft = new ThreeDAuth.Point3d(leftWrist.Position.X, leftWrist.Position.Y, leftWrist.Position.Z);

                    ThreeDAuth.DepthPoint left = this.SkeletonPointToScreen(leftWrist.Position);

                    if (myPlane.crossesPlane(left))
                    {
                        //drawingContext.DrawRoundedRectangle(Brushes.Blue, null, new Rect(left.X, left.Y, 30, 30), null, 14, null, 14, null);
                    }
                    else
                    {
                        //drawingContext.DrawRoundedRectangle(Brushes.Red, null, new Rect(left.X, left.Y, 30, 30), null, 14, null, 14, null);
                    }

                    // Mason's code
                    // If we're learning a gesture, draw the learned points
                    if (gLearner != null && gLearner.isRecording)
                    {
                        System.Collections.Generic.Queue<ThreeDAuth.Point2d> currentPoints = gLearner.getGesturePath();
                        foreach (ThreeDAuth.Point2d point in currentPoints)
                        {
                            drawingContext.DrawRoundedRectangle(Brushes.Green, null, new Rect(point.x, point.y, 30, 30), null, 14, null, 14, null);

                        }
                    }

                    if (gLearner != null && gLearner.isRecording && doneButtonTimePercentage >= 1.0)
                    {
                        // Done recording
                        gLearner.stopRecording();
                        this.myImageBox.Visibility = System.Windows.Visibility.Collapsed;
                        List<ThreeDAuth.Point2d> password = new List<ThreeDAuth.Point2d>(gLearner.getGesturePath());
                        this.currentUser.password = password;
                        this.gestureMassage.Text = "Success. Your account has been created. Welcome to 3DAuth!";
                        SaveUser(currentUser);
                    }

                    if (inButton && resetButtonTimePercentage >= 1.0)
                    {
                        if (gLearner != null && gLearner.isRecording)
                        {
                            // Reset the learner
                            gLearner.restart();
                        }
                        else if (gValidator != null)
                        {
                            // Reset the validator
                            gValidator.restart();
                        }
                    }

                    /*
                    // If we're learning a gesture and we've been out of the plane for 5 seconds, stop learning
                    if (gLearner.isRecording && !planePoint.inPlane)
                    {
                        if (!outOfPlaneTimer.IsRunning)
                        {
                            outOfPlaneTimer.Start();
                        }
                        if (outOfPlaneTimer.ElapsedMilliseconds > BUTTON_HOLD_CUTOFF)
                        {
                            gLearner.stopRecording();
                            this.myImageBox.Visibility = System.Windows.Visibility.Collapsed;
                            List<ThreeDAuth.Point2d> password = new List<ThreeDAuth.Point2d>(gLearner.getGesturePath());
                            this.currentUser.password = password;
                            this.gestureMassage.Text = "Success. Your account has been created. Welcome to 3DAuth!";
                            SaveUser(currentUser);
                        }
                    }
                    else if (gLearner.isRecording)
                    {
                        outOfPlaneTimer.Reset();
                    }
                     * */
                }
            }
        }
        private void OnRender_BackgroundColor(
            DrawingContext dc,
            Color innerMain,
            Color innerEdge,
            Color innerGlow,
            Color innerShadow)
        {
            var shadowBrush = RenderToolFactory.GetTool<Brush>
                (new SolidColorBrushTool(innerShadow, 1 / 25f));

            var innerMainBrush = RenderToolFactory.GetTool<Brush>(new SolidColorBrushTool(innerMain));

            var innerEdgePen = RenderToolFactory.GetTool<Pen>(new PenTool(innerEdge, 1));
            var innerGlowPen = RenderToolFactory.GetTool<Pen>(new PenTool(innerGlow, 0.5));

            // Inner Area
            {
                const double RADIUS = 10;

                Rect area = new Rect(12, 69, BOT_SCR_WIDTH, 140);

                for (int pX = -2; pX <= 2; pX++)
                {
                    for (int pY = -2; pY <= 2; pY++)
                    {
                        var offArea = area;
                        offArea.Offset(pX, pY + 2);
                        dc.DrawRoundedRectangle(shadowBrush, null, offArea, RADIUS, RADIUS);
                    }
                }

                dc.DrawRoundedRectangle(innerMainBrush, innerEdgePen, area, RADIUS, RADIUS);
                Point p0 = new Point(area.X + RADIUS, area.Y + area.Height + 1);
                Point p1 = new Point(area.X + area.Width - 2 * RADIUS, area.Y + area.Height + 1);
                dc.DrawLine(innerGlowPen, p0, p1);
            }
            // Slots Area
            {
                for (int pX = 1; pX < 7; pX++)
                    for (int pY = 0; pY < 2; pY++)
                    {
                        const double GAP = BOT_SCR_WIDTH / 6.0;
                        const double OFFSET = 86 + (140 - 2 * GAP) / 2;
                        const double RADIUS = 2;

                        Rect area = new Rect(GAP * pX - 8, Math.Floor(GAP * pY + OFFSET), 16, 16);

                        Point p0 = new Point(area.X + RADIUS, area.Y);
                        Point p1 = new Point(area.X + area.Width - RADIUS, area.Y);
                        dc.DrawRoundedRectangle(null, innerEdgePen, area, RADIUS, RADIUS);
                        dc.DrawLine(innerGlowPen, p0, p1);
                    }
            }
        }
        /// <summary>
        /// InkAnalysis results form a tree, this method is called recursively
        /// to render each node in the tree.
        /// </summary>
        private void DrawFeedback(DrawingContext drawingContext, ContextNode contextNode)
        {
            //see what type of ContextNode this is by casting it

            Rect nodeBounds = contextNode.Strokes.GetBounds();
            InkWordNode inkWordNode = contextNode as InkWordNode;
            if (inkWordNode != null)
            {
                drawingContext.DrawRoundedRectangle(null, new Pen(Brushes.Blue, 1.0d), nodeBounds, 1d, 1d);
                drawingContext.DrawText(new FormattedText(inkWordNode.GetRecognizedString(),
                                                            CultureInfo.CurrentCulture,
                                                            FlowDirection.LeftToRight,
                                                            new Typeface("Verdana"),
                                                            9.0d,
                                                            Brushes.Black),
                                        nodeBounds.BottomLeft);

                //check current output value
                CheckOutputValue(contextNode.Strokes, inkWordNode.GetRecognizedString());
                goto recurse;
            }

            InkDrawingNode inkDrawingNode = contextNode as InkDrawingNode;
            if (inkDrawingNode != null)
            {
                drawingContext.DrawRoundedRectangle(null, new Pen(Brushes.Purple, 1.0d), nodeBounds, 1d, 1d);
                drawingContext.DrawText(new FormattedText("Drawing: " + inkDrawingNode.GetShapeName(),
                                                            CultureInfo.CurrentCulture,
                                                            FlowDirection.LeftToRight,
                                                            new Typeface("Verdana"),
                                                            9.0d,
                                                            Brushes.Black),
                                        nodeBounds.BottomLeft);
                CheckOutputValue(contextNode.Strokes, inkDrawingNode.GetShapeName());
                goto recurse;
            }

            InkBulletNode inkBulletNode = contextNode as InkBulletNode;
            if (inkBulletNode != null)
            {
                drawingContext.DrawRoundedRectangle(null, new Pen(Brushes.Green, 1.0d), nodeBounds, 1d, 1d);
                drawingContext.DrawText(new FormattedText(inkBulletNode.GetRecognizedString(),
                                            CultureInfo.CurrentCulture,
                                            FlowDirection.LeftToRight,
                                            new Typeface("Verdana"),
                                            9.0d,
                                            Brushes.Black),
                                        nodeBounds.BottomLeft);
                goto recurse;
            }

            WritingRegionNode writingRegionNode = contextNode as WritingRegionNode;
            if (writingRegionNode != null)
            {
                nodeBounds.Inflate(3d, 3d);
                drawingContext.DrawRoundedRectangle(null, new Pen(Brushes.Black, 1.0d), nodeBounds, 1d, 1d);
                drawingContext.DrawText(new FormattedText("Writing Region",
                                            CultureInfo.CurrentCulture,
                                            FlowDirection.LeftToRight,
                                            new Typeface("Verdana"),
                                            9.0d,
                                            Brushes.Black),
                                        nodeBounds.BottomLeft + new Vector(0, 3));
        
                goto recurse;
            }

            ParagraphNode paragraphNode = contextNode as ParagraphNode;
            if (paragraphNode != null)
            {
                nodeBounds.Inflate(2d, 2d); //inflate so this will be visible outside the line node
                drawingContext.DrawRoundedRectangle(null, new Pen(Brushes.Red, 1.0d), nodeBounds, 1d, 1d);
                goto recurse;
            }

            LineNode lineNode = contextNode as LineNode;
            if (lineNode != null)
            {
                nodeBounds.Inflate(1d, 1d); //inflate so this will be visible outside the word node
                drawingContext.DrawRoundedRectangle(null, new Pen(Brushes.Orange, 1.0d), nodeBounds, 1d, 1d);
                goto recurse;
            }

        recurse:
            foreach (ContextNode subNode in contextNode.SubNodes)
            {
                DrawFeedback(drawingContext, subNode);
            }
        }
        private void Render(DrawingContext drawingContext)
        {
            var zoom = Convert.ToDouble(App.Current.Resources["Zoom"] ?? 1);

            var scrollX = 0d;
            var scrollY = 0d;
            if (_element is ScrollViewer)
            {
                scrollX = ((ScrollViewer)_element).HorizontalOffset;
                scrollY = ((ScrollViewer)_element).VerticalOffset;
            }

            var cursorPosition = Mouse.GetPosition(_element);

            var width = this.Width * zoom;
            var height = this.Height * zoom;
            var snapWidth = this.SnapWidth * zoom;
            var snapHeight = this.SnapHeight * zoom;
            var scrollOffsetX = (int)scrollX % snapWidth;
            var scrollOffsetY = (int)scrollY % snapHeight;

            var snapX = (int)((cursorPosition.X + scrollOffsetX) / snapWidth) * snapWidth - scrollOffsetX;
            var snapY = (int)((cursorPosition.Y + scrollOffsetY) / snapHeight) * snapHeight - scrollOffsetY;

            var finalX = snapX - (_hotX * zoom);
            var finalY = snapY - (_hotY * zoom);

            drawingContext.DrawImage(this.CursorImage,
                new Rect(
                    finalX,
                    finalY,
                    width,
                    height)
                );

            if (DrawOutline)
            {
                drawingContext.DrawRectangle(null, outlinePen, new Rect(finalX, finalY, width, height));
                drawingContext.DrawRoundedRectangle(null, shadowPen, new Rect(finalX - 1, finalY - 1, width + 2, height + 2), 2, 2);
            }
        }
        //Called everytime the Trajectory instance is rendered (once per frame). Will draw the trajectory, trajectory info box, skeleton center point
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            if (currentSkeleton != null && currentSkeleton.TrackingState == SkeletonTrackingState.PositionOnly && shouldDraw)
            {
                drawingContext.DrawEllipse(
                            this.centerPointBrush,
                            null,
                            this.currentPoint,
                            BodyCenterThickness,
                            BodyCenterThickness);

                try
                {
                    //TrajectoryTextBrush.Opacity = .5;

                    trajectoryText = new FormattedText("Skeleton " + trackedSkeleton + "\nvelocity (filtered): " + this.v_filtered.ToString("#.##" + " m/s")  + "\nDirection: " + this.Direction
                        + "\nDistance: " + this.Distance,
                        //+"\ndY: " + deltaY + "  dZ: " + deltaZ,
                        //+ "\nX: " + currentSkeleton.Position.X + "  Y: " + currentSkeleton.Position.Y + "   Z: " + currentSkeleton.Position.Z,
                                                CultureInfo.GetCultureInfo("en-us"),
                                                FlowDirection.LeftToRight,
                                                new Typeface("Verdana"),
                                                12,
                                                this.TrajectoryBrush);

                    drawingContext.DrawRoundedRectangle(TrajectoryTextBrush, 
                                                            null, 
                                                            new Rect(currentPoint.X + textOffset, currentPoint.Y + textOffset, trajectoryText.Width, trajectoryText.Height),
                                                            1, 
                                                            1);

                    drawingContext.DrawText(trajectoryText,
                                                new Point(currentPoint.X + textOffset, currentPoint.Y + textOffset));
                   
                }
                catch
                {
                    return;
                }
            }
            
            //To draw trajectory only if there is something to draw and if the skeleton is tracked
            if (trajectoryPathGeometry != null && currentSkeleton != null && currentSkeleton.TrackingState!=SkeletonTrackingState.NotTracked)
            {
                drawingContext.DrawGeometry(null, new Pen(this.TrajectoryBrush,2), this.trajectoryPathGeometry);
            }
            
        }
Exemple #27
0
 protected override void OnRender(DrawingContext drawingContext)
 {
     Brush b = new SolidColorBrush(Color.FromRgb(128, 128, 128));
     Pen p = new Pen(new SolidColorBrush(Color.FromRgb(255, 255, 255)), 3);
     drawingContext.DrawRoundedRectangle(b, p, new Rect(0, 0, Width, Height), 5, 5);
 }
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            RectangleFill profileRectangle = Visual as RectangleFill;

            drawingContext.DrawRoundedRectangle(_fillBrush, _borderPen, _imageRect, profileRectangle.CornerRadius, profileRectangle.CornerRadius);
        }
 public override void Draw(DrawingContext drawingContext, Point origin, bool rightToLeft, bool sideways)
 {
     Point newOrigin = new Point(origin.X + 1.5, origin.Y);
     var metrics = base.Format(double.PositiveInfinity);
     Rect r = new Rect(newOrigin.X - 0.5, newOrigin.Y - metrics.Baseline, metrics.Width + 2, metrics.Height);
     drawingContext.DrawRoundedRectangle(SpecialCharacterTextRunOptions.BackgroundBrush ?? SpecialCharacterTextRunOptions.DefaultBackgroundBrush, null, r, 2.5, 2.5);
     base.Draw(drawingContext, newOrigin, rightToLeft, sideways);
 }
        private void DrawShadow(DrawingContext dc, ref Rect bounds)
        {
            if ((bounds.Width > 0.0) && (bounds.Height > 2.0))
            {
                Pen pen = Shadow;
                if (pen != null)
                {
                    dc.DrawRoundedRectangle(
                        null,
                        pen,
                        new Rect(bounds.X, bounds.Y + 2.0, bounds.Width, bounds.Height - 2.0),
                        3.0, 3.0);

                    bounds.Height -= 1.0;
                    bounds.Width = Math.Max(0.0, bounds.Width - 1.0);
                }
            }
        }
Exemple #31
0
      protected override void OnRender(DrawingContext drawingContext)
      {
         if(!Core.IsStarted)
            return;

         drawingContext.DrawRectangle(EmptyMapBackground, null, new Rect(RenderSize));

         if(IsRotated)
         {
            drawingContext.PushTransform(rotationMatrix);

            if(MapScaleTransform != null)
            {
               drawingContext.PushTransform(MapScaleTransform); 
               drawingContext.PushTransform(MapTranslateTransform);
               {
                  DrawMap(drawingContext);
               }
               drawingContext.Pop();
               drawingContext.Pop();
            }
            else
            {
               drawingContext.PushTransform(MapTranslateTransform);
               {
                  DrawMap(drawingContext);
               }
               drawingContext.Pop();
            }

            drawingContext.Pop();
         }
         else
         {
            if(MapScaleTransform != null)
            {
               drawingContext.PushTransform(MapScaleTransform);
               drawingContext.PushTransform(MapTranslateTransform);
               {
                  DrawMap(drawingContext);

#if DEBUG
                  drawingContext.DrawLine(VirtualCenterCrossPen, new Point(-20, 0), new Point(20, 0));
                  drawingContext.DrawLine(VirtualCenterCrossPen, new Point(0, -20), new Point(0, 20));
#endif
               }
               drawingContext.Pop();
               drawingContext.Pop();
            }
            else
            {
               drawingContext.PushTransform(MapTranslateTransform);
               {
                  DrawMap(drawingContext);
#if DEBUG
                  drawingContext.DrawLine(VirtualCenterCrossPen, new Point(-20, 0), new Point(20, 0));
                  drawingContext.DrawLine(VirtualCenterCrossPen, new Point(0, -20), new Point(0, 20));
#endif
               }
               drawingContext.Pop();
            }
         }

         // selection
         if(!SelectedArea.IsEmpty)
         {
            GPoint p1 = FromLatLngToLocal(SelectedArea.LocationTopLeft);
            GPoint p2 = FromLatLngToLocal(SelectedArea.LocationRightBottom);

            long x1 = p1.X;
            long y1 = p1.Y;
            long x2 = p2.X;
            long y2 = p2.Y;

            if(SelectionUseCircle)
            {
               drawingContext.DrawEllipse(SelectedAreaFill, SelectionPen, new System.Windows.Point(x1 + (x2 - x1) / 2, y1 + (y2 - y1) / 2), (x2 - x1) / 2, (y2 - y1) / 2);
            }
            else
            {
               drawingContext.DrawRoundedRectangle(SelectedAreaFill, SelectionPen, new Rect(x1, y1, x2 - x1, y2 - y1), 5, 5);
            }
         }

         if(ShowCenter)
         {
            drawingContext.DrawLine(CenterCrossPen, new System.Windows.Point((ActualWidth / 2) - 5, ActualHeight / 2), new System.Windows.Point((ActualWidth / 2) + 5, ActualHeight / 2));
            drawingContext.DrawLine(CenterCrossPen, new System.Windows.Point(ActualWidth / 2, (ActualHeight / 2) - 5), new System.Windows.Point(ActualWidth / 2, (ActualHeight / 2) + 5));
         }

         if(renderHelperLine)
         {
            var p = Mouse.GetPosition(this);

            drawingContext.DrawLine(HelperLinePen, new Point(p.X, 0), new Point(p.X, ActualHeight));
            drawingContext.DrawLine(HelperLinePen, new Point(0, p.Y), new Point(ActualWidth, p.Y));
         }

         #region -- copyright --

         if(Copyright != null)
         {
            drawingContext.DrawText(Copyright, new System.Windows.Point(5, ActualHeight - Copyright.Height - 5));
         }

         #endregion

         base.OnRender(drawingContext);
      }
        private void OnRender_BackgroundColor(
            DrawingContext dc,
            Color outerMain,
            Color outerEdgeStripes,
            Color outerGlow,
            Color innerMain,
            Color innerEdge,
            Color innerGlow,
            Color innerShadow)
        {
            var outerMainBrush = RenderToolFactory.GetTool<Brush>
                (new SolidColorBrushTool(outerMain));
            var outerLeftGlowBrush = RenderToolFactory.GetTool<Brush>
                (new LinearGradientBrushTool(outerGlow, outerMain, 0, 0.3));
            var outerRightGlowBrush = RenderToolFactory.GetTool<Brush>
                (new LinearGradientBrushTool(outerMain, outerGlow, 0, 0.3));
            var shadowBrush = RenderToolFactory.GetTool<Brush>
                (new SolidColorBrushTool(innerShadow, 1 / 25f));

            var innerMainBrush = RenderToolFactory.GetTool<Brush>(new SolidColorBrushTool(innerMain));

            var innerEdgePen = RenderToolFactory.GetTool<Pen>(new PenTool(innerEdge, 1));
            var innerGlowPen = RenderToolFactory.GetTool<Pen>(new PenTool(innerGlow, 0.5));

            // Outer Area
            {
                dc.DrawRectangle(outerMainBrush, null, new Rect(0, 0, BOT_SCR_WIDTH, BOT_SCR_HEIGHT));

                dc.DrawRectangle(outerLeftGlowBrush, null, new Rect(0, 0, 24, BOT_SCR_HEIGHT));
                dc.DrawRectangle(outerRightGlowBrush, null, new Rect(BOT_SCR_WIDTH - 24, 0, 24, BOT_SCR_HEIGHT));

                for (int i = 0; i < 7; i++)
                {
                    var opacity = (1 - i / 7f) / 2;
                    var pen = RenderToolFactory.GetTool<Pen>(new PenTool(outerEdgeStripes, 0.5, opacity));
                    dc.DrawLine(pen,
                        new Point(0, BOT_SCR_HEIGHT - 4 * i - 2.5),
                        new Point(BOT_SCR_WIDTH, BOT_SCR_HEIGHT - 4 * i - 2.5));
                }
            }
            // Inner Area
            {
                const double RADIUS = 10;

                Rect area = new Rect(12, 39, BOT_SCR_WIDTH, 170);

                for (int pX = -2; pX <= 2; pX++)
                {
                    for (int pY = -2; pY <= 2; pY++)
                    {
                        var offArea = area;
                        offArea.Offset(pX, pY + 2);
                        dc.DrawRoundedRectangle(shadowBrush, null, offArea, RADIUS, RADIUS);
                    }
                }

                dc.DrawRoundedRectangle(innerMainBrush, innerEdgePen, area, RADIUS, RADIUS);
                Point p0 = new Point(area.X + RADIUS, area.Y + area.Height + 1);
                Point p1 = new Point(area.X + area.Width - 2 * RADIUS, area.Y + area.Height + 1);
                dc.DrawLine(innerGlowPen, p0, p1);
            }
            // Slots Area
            {
                for (int pX = 1; pX < 7; pX++)
                    for (int pY = 0; pY < 3; pY++)
                    {
                        const double GAP = BOT_SCR_WIDTH / 6.0;
                        const double OFFSET = 31 + (170 - 2 * GAP) / 2;
                        const double RADIUS = 2;

                        Rect area = new Rect(GAP * pX - 8, Math.Floor(GAP * pY + OFFSET), 16, 16);

                        Point p0 = new Point(area.X + RADIUS, area.Y);
                        Point p1 = new Point(area.X + area.Width - RADIUS, area.Y);
                        dc.DrawRoundedRectangle(null, innerEdgePen, area, RADIUS, RADIUS);
                        dc.DrawLine(innerGlowPen, p0, p1);
                    }
            }
        }
Exemple #33
0
 /// <summary> 
 /// Render callback.
 /// </summary> 
 protected override void OnRender(DrawingContext drawingContext) 
 {
     Pen pen = GetPen(); 
     drawingContext.DrawRoundedRectangle(Fill, pen, _rect, RadiusX, RadiusY);
 }
        private void OnRender_BackgroundTexture(DrawingContext dc)
        {
            // Outer Area
            {
                var frameType = Theme.Flags.BottomFrameType;
                var scrollEnable = frameType == BottomFrameType.SlowScroll || frameType == BottomFrameType.FastScroll;
                var flipEnable = frameType == BottomFrameType.PageScroll;
                var bounceEnable = frameType == BottomFrameType.BounceScroll;

                var bgBitmap = Theme.Textures.Bottom.Bitmap;

                if (scrollEnable)
                {
                    // 802 = ...? Eyeballed it until it synced
                    var posMap = _isListening
                                     ? (Math.Sin(CompositionTargetEx.SecondsFromStart / 3) + 1) * 802
                                     : 0;

                    if (posMap < 1008)
                        dc.DrawImage(bgBitmap, new Rect(-posMap, 0, bgBitmap.Width, bgBitmap.Height));
                    if (posMap + BOT_SCR_WIDTH > 1008)
                        dc.DrawImage(bgBitmap, new Rect(-posMap + 1007, 0, bgBitmap.Width, bgBitmap.Height));
                }
                else if (flipEnable)
                {
                    var posMap = _isListening
                                     ? (int) Math.Floor(CompositionTargetEx.SecondsFromStart % 3)
                                     : 0;

                    dc.DrawImage(bgBitmap, new Rect(-posMap * BOT_SCR_WIDTH, 0, bgBitmap.Width, bgBitmap.Height));
                }
                else if (bounceEnable)
                {
                    var posMap = _isListening
                                     ? (int) Math.Floor(CompositionTargetEx.SecondsFromStart % 4)
                                     : 0;

                    posMap = posMap == 3 ? 1 : posMap;
                    dc.DrawImage(bgBitmap, new Rect(-posMap * BOT_SCR_WIDTH, 0, bgBitmap.Width, bgBitmap.Height));
                }
                else
                {
                    dc.DrawImage(bgBitmap, new Rect(0, 0, bgBitmap.Width, bgBitmap.Height));
                }
            }
            // Slots Area
            {
                var innerSlotBrush = RenderToolFactory.GetTool<Brush>(new SolidColorBrushTool(Colors.White, 0.2));
                for (int pX = 1; pX < 7; pX++)
                    for (int pY = 0; pY < 3; pY++)
                    {
                        const double GAP = BOT_SCR_WIDTH / 6.0;
                        const double OFFSET = 31 + (170 - 2 * GAP) / 2;
                        const double RADIUS = 2;

                        Rect area = new Rect(GAP * pX - 8, GAP * pY + OFFSET, 16, 16);
                        dc.DrawRoundedRectangle(innerSlotBrush, null, area, RADIUS, RADIUS);
                    }
            }
        }
        private void DrawBorders(DrawingContext dc, ref Rect bounds)
        {
            if ((bounds.Width >= 2.0) && (bounds.Height >= 2.0))
            {
                Brush brush = Fill;
                Pen pen = OuterBorder;
                if (pen != null)
                {
                    dc.DrawRoundedRectangle(
                        brush,
                        pen,
                        new Rect(bounds.X, bounds.Y, bounds.Width, bounds.Height),
                        2.0, 2.0);
                    brush = null; // Done with the fill
                    bounds.Inflate(-1.0, -1.0);
                }

                if ((bounds.Width >= 2.0) && (bounds.Height >= 2.0))
                {
                    pen = InnerBorder;
                    if ((pen != null) || (brush != null))
                    {
                        dc.DrawRoundedRectangle(
                            brush,
                            pen,
                            new Rect(bounds.X, bounds.Y, bounds.Width, bounds.Height),
                            1.5, 1.5);
                        bounds.Inflate(-1.0, -1.0);
                    }
                }
            }
        }
			public override void Draw(DrawingContext drawingContext, Point origin, bool rightToLeft, bool sideways)
			{
				Point newOrigin = new Point(origin.X + 1, origin.Y);
				var metrics = Format(double.PositiveInfinity);
				Rect r = new Rect(newOrigin.X + 1, newOrigin.Y - metrics.Baseline, metrics.Width + 1, metrics.Height);
				drawingContext.DrawRoundedRectangle(Brushes.DarkGray, null, r, 2.5, 2.5);
				base.Draw(drawingContext, newOrigin, rightToLeft, sideways);
			}