WPF svg 轉 xmal

今天wpf裏面要用矢量圖,美工出的是svg格式的,須要將svg格式的轉換爲xamlgit

1.第一個嘗試是安裝Inkscape,這個軟件能夠直接將svg另存爲xaml,可是最終發現轉換出來會出現錯誤github

2.這是一個開源項目:c#

項目地址:https://github.com/BerndK/SvgToXamlsvg

他下面具體用的是這個:sharpvectors(http://sharpvectors.codeplex.com/)這個直接能在c#裏使用svgcode

呵呵,用這個轉成功了,目前沒有轉失敗的狀況blog

他轉出來直接是Drawingimage資源,以下ip

<DrawingImage x:Key="____3_01DrawingImage">
            <DrawingImage.Drawing>
                <DrawingGroup ClipGeometry="M0,0 V89 H230 V0 H0 Z">
                    <GeometryDrawing Brush="#FFD1D1D1" Geometry="F1 M230,89z M0,0z M222.5,80L222.5,80 14.1,80 14.1,77.6 15.1,77.6 15.1,79 221.5,79 221.5,11.6 215.8,11.6 215.8,10.6 222.5,10.6z" />
                    <DrawingGroup>
                        <GeometryDrawing Brush="#FF4AC0E0">
                            <GeometryDrawing.Geometry>
                                <RectangleGeometry RadiusX="0" RadiusY="0" Rect="9.7,7.7,209.3,69.9" />
                            </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                    </DrawingGroup>
                </DrawingGroup>
            </DrawingImage.Drawing>
        </DrawingImage>
相關文章
相關標籤/搜索