Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SvgViewbox"/> class.
        /// </summary>
        public SvgViewbox()
        {
            _textAsGeometry = false;
            _includeRuntime = true;
            _optimizePath   = true;
            _drawingCanvas  = new SvgDrawingCanvas();

            this.Child      = _drawingCanvas;
        }
Exemplo n.º 2
0
        public SvgAnimationLayer(SvgDrawingCanvas drawingCanvas)
        {
            _animator      = new SvgAnimator();
            _drawingCanvas = drawingCanvas;

            _displayTransform = Transform.Identity;

            _colorText     = Colors.Black;
            _colorLink     = Colors.Blue;
            _colorSelected = Colors.Red;
            _colorHover    = (Color)ColorConverter.ConvertFromString("#ffa500");

            _visualBrushes = new Dictionary <string, Brush>(StringComparer.OrdinalIgnoreCase);

            _drawObjects = new List <Drawing>();
            _linkObjects = new List <Drawing>();

            // Create a tooltip and set its position.
            _tooltip                    = new ToolTip();
            _tooltip.Placement          = PlacementMode.MousePoint;
            _tooltip.PlacementRectangle = new Rect(50, 0, 0, 0);
            _tooltip.HorizontalOffset   = 20;
            _tooltip.VerticalOffset     = 20;

            _tooltipText        = new TextBlock();
            _tooltipText.Text   = string.Empty;
            _tooltipText.Margin = new Thickness(6, 0, 0, 0);

            //Create BulletDecorator and set it as the tooltip content.
            Ellipse bullet = new Ellipse();

            bullet.Height = 10;
            bullet.Width  = 10;
            bullet.Fill   = Brushes.LightCyan;

            BulletDecorator decorator = new BulletDecorator();

            decorator.Bullet = bullet;
            decorator.Margin = new Thickness(0, 0, 10, 0);
            decorator.Child  = _tooltipText;

            _tooltip.Content    = decorator;
            _tooltip.IsOpen     = false;
            _tooltip.Visibility = Visibility.Hidden;

            //Finally, set tooltip on this canvas
            _drawingCanvas.ToolTip = _tooltip;
            //_drawingCanvas.Background = Brushes.Transparent;
        }
Exemplo n.º 3
0
 /// <summary>
 /// 创建SvgDrawingCanvas(Svg画布)
 /// </summary>
 /// <param name="svgReader"></param>
 /// <returns>SvgDrawingCanvas(Svg画布)</returns>
 private static SvgDrawingCanvas CreateSvgDrawingCanvas(FileSvgReader svgReader)
 {
     SvgDrawingCanvas svgCanvas = new SvgDrawingCanvas();
     svgCanvas.RenderDiagrams(svgReader.Drawing);
     return svgCanvas;
 }