在字符串表示形式中移动 C# 中的 System.Windows.Shapes.Path
我有一些 Path
的字符串表示。我想移动字符串演示中的路径对象。例如,我将 "M 10,100 C 100,0 200,200 300,100"
移动到 (5, 0)
上并得到 "M 15,100 C 105,0 205,200 305,100"< /代码>。有标准方法吗?
I have string presentation of some Path
. I want to move path object in string presentation. For example I move "M 10,100 C 100,0 200,200 300,100"
on (5, 0)
and get "M 15,100 C 105,0 205,200 305,100"
. There is standart method for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的方法是使用小写版本的命令来定义路径中相对于当前点的所有坐标:
这样您只需更改初始移动坐标,整个形状就会受到影响。
The easiest way to do this is to define all coordinates in the path relative to the current point, by using the lowercase version of the commands:
this way you only need to change the initial Move coordinates and the entire shape will be affected.
没有任何内置或“标准”的东西。
您将需要解析字符串(或反序列化它),进行更新并输出结果。
There is nothing built in or "standard".
You will need to parse the string (or deserialize it), make the updates and output the result.