小编Mac*_*cko的帖子

SkiaSharp SVG click元素获取ID

假设我有svg文件,如下所示:

 "<svg height='300' width='300'><rect class='rect us' id='12212' x='34' y='54' width='20' height='20'/><rect class='rect us' id='12213' x='64' y='54' width='20' height='20'/></svg>
Run Code Online (Sandbox Code Playgroud)

是否可以按给定的点命中SVGElement测试并获得该元素的ID?如果可以,我该如何完成这项任务?我做了一些谷歌搜索,却找不到任何东西。

c# svg skia skiasharp

5
推荐指数
0
解决办法
347
查看次数

奇怪的 XAML RenderTransform 行为 (SVG)

我有一个使用 Inkscape 转换为 XAML 的 svg 文件,但出了点问题。这是我的期望:在此处输入图片说明

这就是我得到的:

在此处输入图片说明

有任何想法吗?

SVG文件:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1920" height="1080">
<rect x="51" y="37" width="198" height="99" id="rect1" style="fill-opacity:0;stroke-width:1;stroke:rgb(0,0,0);fill:rgb(255,255,255)"  />
<rect x="111" y="178" width="216" height="125" id="rect2" style="fill-opacity:0;stroke-width:1;stroke:rgb(0,0,0);fill:rgb(255,255,255)"  />
<rect x="302" y="42" width="181" height="113" id="rect3" style="fill-opacity:0;stroke-width:1;stroke:rgb(0,0,0);fill:rgb(255,255,255)"  />
<rect x="391" y="234" width="94" height="84" id="rect4" style="fill-opacity:0;stroke-width:1;stroke:rgb(0,0,0);fill:rgb(255,255,255)" transform="matrix(0.7071068,0.7071068,-0.7071068,0.7071068,323.4487,-228.8742)" />
</svg>
Run Code Online (Sandbox Code Playgroud)

XAML 生成的文件:

<?xml version="1.0" encoding="UTF-8"?>
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Stretch="Uniform">
  <Canvas Name="svg6" Width="1920" Height="1080">
    <Canvas.Resources/>
    <Rectangle xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="51" Canvas.Top="37" Width="198" Height="99" Name="rect1" Fill="#00FFFFFF" StrokeThickness="1" Stroke="#000000"/>
    <Rectangle xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="111" Canvas.Top="178" Width="216" Height="125" Name="rect2" …
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml svg 2d

-2
推荐指数
1
解决办法
305
查看次数

标签 统计

c# ×2

svg ×2

2d ×1

skia ×1

skiasharp ×1

wpf ×1

xaml ×1