Ejemplo n.º 1
0
        private DrawingVisual Create()
        {
            countCreate++;

            var square = new DrawingVisualFx();

            using (DrawingContext dc = square.RenderOpen())
            {
                dc.DrawEllipse(null, Stroke, new Point(Width / 2, Height / 2), Width / 2 + Stroke.Thickness / 2, Height / 2 + Stroke.Thickness / 2);

                if (Angle.HasValue)
                {
                    dc.PushTransform(new RotateTransform(Angle.Value, Width / 2, Height / 2));
                    {
                        PolyLineSegment polySeg = new PolyLineSegment(new Point[] { new Point(Width * 0.2, Height * 0.3), new Point(Width * 0.8, Height * 0.3) }, true);
                        PathFigure      pathFig = new PathFigure(new Point(Width * 0.5, -Height * 0.22), new PathSegment[] { polySeg }, true);
                        PathGeometry    pathGeo = new PathGeometry(new PathFigure[] { pathFig });
                        dc.DrawGeometry(Brushes.AliceBlue, StrokeArrow, pathGeo);
                    }
                    dc.Pop();
                }

                dc.DrawEllipse(Background, null, new Point(Width / 2, Height / 2), Width / 2, Height / 2);
                dc.DrawText(FText, new Point(Width / 2 - FText.Width / 2, Height / 2 - FText.Height / 2));
            }

            return(square);
        }
Ejemplo n.º 2
0
        private static void OnEffectChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            DrawingVisualFx drawingVisualFx = o as DrawingVisualFx;

            if (drawingVisualFx != null)
            {
                drawingVisualFx.setMyProtectedVisualEffect((Effect)e.NewValue);
            }
        }
Ejemplo n.º 3
0
      private DrawingVisual Create()
      {
         countCreate++;

         var square = new DrawingVisualFx();

         using(DrawingContext dc = square.RenderOpen())
         {
            dc.DrawEllipse(null, Stroke, new Point(Width/2, Height/2), Width/2 + Stroke.Thickness/2, Height/2 + Stroke.Thickness/2);

            if(Angle.HasValue)
            {
               dc.PushTransform(new RotateTransform(Angle.Value, Width/2, Height/2));
               {
                  PolyLineSegment polySeg = new PolyLineSegment(new Point[] { new Point(Width*0.2, Height*0.3), new Point(Width*0.8, Height*0.3) }, true);
                  PathFigure pathFig = new PathFigure(new Point(Width*0.5, -Height*0.22), new PathSegment[] { polySeg }, true);
                  PathGeometry pathGeo = new PathGeometry(new PathFigure[] { pathFig });
                  dc.DrawGeometry(Brushes.AliceBlue, StrokeArrow, pathGeo);
               }
               dc.Pop();
            }

            dc.DrawEllipse(Background, null, new Point(Width/2, Height/2), Width/2, Height/2);
            dc.DrawText(FText, new Point(Width/2 - FText.Width/2, Height/2 - FText.Height/2));
         }

         return square;
      }