如何在DrawingImage中使用Path? [英] How to use Path in a DrawingImage?

查看:83
本文介绍了如何在DrawingImage中使用Path?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我定义了一些路径,希望将其转换为DrawingImage资源,但我必须缺少某些内容。

I have some paths defined that I would like to convert into DrawingImage resources but I must be missing something.

ie

我想要这样的东西:

<Path Stroke="DarkGoldenRod" StrokeThickness="3" 
      Data="M 100,200 C 100,25 400,350 400,175 H 280" />

并将其与类似这样的东西一起使用:

and use it with something like this:

<DrawingImage x:Key='icon'>
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing ... />
          . . .
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
</DrawingImage>

有什么建议吗?

-dk

推荐答案

鉴于您对托马斯回答的评论,我非常不知道您想做什么。

I quite don't know what you want to do ... given your comment to Thomas' answer.

但是,Expression Design可以两种不同的WPF方式导出:

However, Expression Design can export in two different WPF ways:


  1. 到ResourceDictionary艺术品变成DrawingBrush,或

  2. 到画布,在该画布中艺术品变成路径和形状。

ResourceDictionary / DrawingBrush方法与您在问题中给出的建议答案以及Thomas的答案非常相似。

The ResourceDictionary/DrawingBrush approach is very similar to the suggested answer you gave in the question and that Thomas answered with.

我建议您使用Expression Design设计艺术品,然后保留.design文件,以便您可以导出为所需的任何格式...尤其是在以后的某个时间。

现在,我知道很多插图都是在Adobe Illustrator中完成的,然后使用Expression Design进行了转换。如果是这样,我将同时保留.ai文件和.design文件,以便您始终可以修改图稿并再次导出。

Now, I know a lot of artwork gets done in Adobe Illustrator and then is converted using Expression Design. If that is the case, I would keep both the .ai file and the .design file so that you can always modify your artwork and export again.

当然,就是为了解决无法将xaml导入Expression Design(即,它不支持往返方案)的问题。

Of course, this is all to get around the issue that you can't import xaml into Expression Design (i.e. it doesn't support a round-trip scenario).

我会做一件事提到的是,有时有时不如将微型路径语言从Path.Data属性复制到GeometryDrawing.Geometry属性那样简单...因为调整场景的大小(意味着DrawingBrush(es)通常设置为Fill)然后它们通常会填满那里的任何空间)。因此,请当心!

One thing I would mention is that sometimes it isn't as easy as just copying the mini-path language from the Path.Data property to the GeometryDrawing.Geometry property ... because of resizing scenarios (meaning that DrawingBrush(es) are typically set to a Fill somewhere and then they typically fill whatever space there is). So, watch out for that!

这篇关于如何在DrawingImage中使用Path?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆