原文:
C#如何在VS2015 2017版本中编写WPF UI界面引入第三方SVG图形
在VS2015 2017版本中编写WPF UI界面引入第三方SVG图形
最近在写WPF界面的时候遇到一个情况,由于界面已经由UI设计师用PS和AI软件画好了,在做UI的时候直接照着图做就行.
wpf中UI编辑是非常方便的.但是如果界面已经有PS或者AI的原图的时候,如果所有的控件都用xaml代码重新画,那势必会占用大量重复的时间. 将PS的原图切图意识一个方法,但是有些UI的控件需要我们在拖动界面的时候或者有些时候放大和缩小,这样切图的png图片如果DPI很低就会失真,DPI高优惠占用大量的资源空间.有没有一个方法能直接使用PS中自定义的形状等资源呢?
在VS2015之前是很方便的,可以用Blend直接导入PS的SVG路径资源,但是在VS2015 及2017以后,胃软取消了导入功能,导致直接使用没有那么方便了.
今天我们就来看看在没有导入功能的情况下怎么使用第三方编辑好的SVG图像.
1. 取SVG路径代码
在PS中可以直接复制图层为SVG : 点击需要导出的图层 --> 右键 --> 复制SVG --> 粘贴到文本编辑器中
也可以直接导出为SVG文件. AI中直接另存为选择SVG文件就行了.
2.取出需要的路径代码
导出的SVG代码长什么样子呢? 我们来看看:
<?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd"> <svg version="1.1" baseProfile="basic" id="图层_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="671.571px" height="841.89px" viewBox="0 0 671.571 841.89" xml:space="preserve"> <g> <polygon fill="#101010" points="382.258,914.655 376.335,908.732 341.414,943.75 353.227,943.75 "/> <polygon fill="#101010" points="325.899,927.681 337.743,927.68 366.514,898.911 360.591,892.988 "/> <polygon fill="#101010" points="391.373,923.771 348.227,966.916 308.328,927.021 351.477,883.874 351.364,883.762 286.336,893.748 286.352,1003.748 316.353,1033.811 316.383,990.787 361.383,983.739 361.341,1033.754 391.347,1033.775 391.359,988.78 371.371,968.799 391.384,948.765 391.394,923.791 "/> </g> <path fill="#101010" d="M279.305,1006.818l0.068-63.068l-258.172,0.047l-4.865,89.959l290.132-0.002L279.305,1006.818z M92.208,952.799c-0.038,0.449-0.133,2.084-0.283,4.9l-0.339,6.143c-0.076,1.314-0.113,2.648-0.113,4 c-7.274-0.301-13.379-0.453-18.316-0.453c-5.427,0-9.093,0.01-10.995,0.029c-1.904,0.02-4.872,0.104-8.904,0.254l-0.687,13.002 c4.449,0.113,9.632,0.17,15.55,0.17c2.111,0,7.728-0.131,16.851-0.396c-0.377,4.825-0.735,10.571-1.073,17.241 c-6.517-0.074-11.526-0.113-15.028-0.113c-5.198,0-11.018,0.133-17.458,0.396l-0.672,13.736h6.497c1.92,0,5.894-0.055,11.92-0.168 l11.695-0.283c1.732-0.037,4.632-0.188,8.7-0.453c-0.452,5.578-0.829,11.346-1.13,17.299c-9.196-0.074-19.277-0.113-30.244-0.113 l-24.874,0.057l-8.027,0.057c0.944-9.723,1.634-17.863,2.069-24.422c0.435-6.557,0.869-15.271,1.304-26.145 s0.652-18.08,0.652-21.623l-0.057-4.975c8.892,0.075,19.65,0.112,32.274,0.112c11.644,0,21.911-0.037,30.804-0.112L92.208,952.799z M159.659,999.047c-0.563,7.387-0.997,17.072-1.297,29.057c-3.696-0.074-7.372-0.113-11.03-0.113c-3.544,0-7.315,0.039-11.313,0.113 c0.514-4.145,1.085-12.699,1.71-25.664c-1.429,0.678-2.547,1.168-3.356,1.469c-0.809,0.303-2.229,0.754-4.258,1.357 s-3.619,1.111-4.765,1.525c-1.147,0.416-2.143,0.943-2.989,1.584s-1.448,1.299-1.805,1.979c-0.357,0.678-0.535,1.432-0.535,2.262 c0,1.281,0.509,2.373,1.526,3.277s2.637,1.357,4.862,1.357c0.791,0,1.639-0.064,2.543-0.197c0.905-0.133,2.148-0.461,3.731-0.99 c-1.094,2.902-2.394,7.143-3.901,12.721c-3.242,0.527-6.313,0.791-9.214,0.791c-4.674,0-8.564-0.65-11.674-1.951 c-3.109-1.299-5.503-3.4-7.18-6.303c-1.677-2.902-2.516-5.803-2.516-8.705c0-1.771,0.31-3.506,0.932-5.201 c0.622-1.697,1.592-3.354,2.91-4.975c1.318-1.621,2.863-3.006,4.634-4.156c1.771-1.148,4.191-2.232,7.262-3.25 s6.959-1.979,11.669-2.883c1.959-0.377,3.757-0.782,5.397-1.216c1.639-0.433,2.806-0.81,3.503-1.13 c0.697-0.32,1.263-0.697,1.695-1.131s0.744-0.885,0.933-1.357c0.188-0.471,0.283-0.97,0.283-1.498c0-1.432-0.603-2.534-1.808-3.307 c-1.206-0.771-2.976-1.159-5.311-1.159c-6.48,0-14.484,1.829-24.015,5.483c0.716-3.73,1.168-6.303,1.357-7.717 c0.188-1.412,0.489-3.627,0.904-6.643c10.854-2.373,20.183-3.561,27.986-3.561c4.447,0,8.519,0.5,12.212,1.498 s6.578,2.609,8.651,4.833c2.073,2.224,3.11,5.409,3.11,9.554C160.505,986.912,160.222,991.66,159.659,999.047z M196,988.984 c0.15,0.377,0.424,0.773,0.819,1.188c0.396,0.414,0.885,0.839,1.47,1.271c0.584,0.434,2.007,1.441,4.269,3.025 c2.261,1.582,4.032,2.883,5.314,3.9c2.11,1.658,3.721,3.193,4.833,4.607c1.111,1.412,1.959,2.92,2.544,4.521 c0.584,1.604,0.876,3.289,0.876,5.061c0,2.676-0.65,5.135-1.95,7.377c-1.3,2.242-3.26,4.117-5.879,5.625 c-2.62,1.508-5.456,2.553-8.508,3.137c-3.053,0.584-6.2,0.877-9.441,0.877c-2.186,0-4.928-0.189-8.225-0.566 c-3.298-0.377-7.133-1.035-11.504-1.979c-0.151-1.658-0.302-3.4-0.452-5.229c-0.151-1.828-0.396-4.344-0.735-7.547l-0.452-4.07 c3.647,1.434,6.786,2.498,9.418,3.193c2.632,0.699,5.057,1.047,7.276,1.047c1.842,0,3.337-0.17,4.483-0.51 c1.146-0.338,1.984-0.828,2.51-1.469c0.527-0.641,0.79-1.301,0.79-1.979c0-0.604-0.198-1.197-0.592-1.781 c-0.395-0.584-1.288-1.385-2.678-2.402c-3.082-2.262-5.797-4.314-8.146-6.162c-2.35-1.846-4.116-3.486-5.3-4.918 s-2.085-2.977-2.706-4.636c-0.62-1.658-0.93-3.372-0.93-5.145c0-3.128,0.895-6.049,2.686-8.763c1.79-2.713,4.428-4.682,7.914-5.907 c3.486-1.224,7.735-1.837,12.748-1.837c5.238,0,11.928,0.678,20.068,2.035l0.905,15.828c-4.561-1.809-8.952-2.713-13.172-2.713 c-2.978,0-5.136,0.307-6.473,0.918c-1.338,0.613-2.007,1.551-2.007,2.813C195.773,988.213,195.848,988.607,196,988.984z M255.604,1009.506c0.396,1.205,1.094,2.072,2.093,2.6c0.999,0.529,2.103,0.791,3.309,0.791c0.905,0,1.849-0.064,2.829-0.197 c0.98-0.131,2.714-0.537,5.203-1.215c-0.679,3.166-1.263,6.256-1.753,9.271l-1.243,6.896c-3.731,0.828-6.643,1.355-8.734,1.582 s-4.118,0.34-6.077,0.34c-3.204,0-6.049-0.273-8.536-0.82s-4.561-1.545-6.218-2.996c-1.659-1.451-2.79-3.117-3.392-5.002 c-0.603-1.885-0.904-3.883-0.904-5.994c0-0.375,0.019-1.045,0.056-2.006s0.168-3.1,0.394-6.416l1.236-19.561h-8.808 c0.187-2.6,0.357-6.029,0.508-10.289l0.169-5.257h9.368c0.224-1.733,0.505-5.521,0.843-11.362l9.677-1.979 c1.773-0.34,5.545-1.206,11.319-2.602c-0.265,4.938-0.454,10.252-0.567,15.942h12.891c-0.302,7.839-0.451,13.022-0.451,15.546 h-13.007l-0.681,14.133c-0.076,2.111-0.113,3.469-0.113,4.07C255.011,1006.791,255.209,1008.299,255.604,1009.506z"/> <g> <path fill="#101010" d="M434.512,968.363c4.707,0,9.236,0.722,13.584,2.164c4.348,1.443,8.021,3.523,11.021,6.237 c3,2.716,5.213,5.887,6.637,9.513s2.136,7.528,2.136,11.705c0,4.063-0.636,7.927-1.908,11.591 c-1.272,3.665-3.427,7.102-6.465,10.31c-3.038,3.21-6.901,5.611-11.591,7.206c-4.691,1.595-9.655,2.392-14.896,2.392 c-4.823,0-9.455-0.702-13.897-2.107c-4.443-1.404-8.156-3.454-11.137-6.151c-2.98-2.695-5.221-5.924-6.721-9.683 c-1.5-3.76-2.25-7.709-2.25-11.848s0.73-8.089,2.193-11.848c1.461-3.76,3.777-7.139,6.949-10.139c3.17-3,7.091-5.307,11.762-6.921 S429.461,968.363,434.512,968.363z M434.113,985.109c-2.432,0-4.596,0.627-6.494,1.88s-3.332,3.085-4.301,5.496 c-0.968,2.412-1.452,5.041-1.452,7.89c0,4.177,1.044,7.376,3.133,9.598c2.088,2.221,4.708,3.332,7.86,3.332 c2.393,0,4.537-0.636,6.437-1.908c1.898-1.272,3.332-3.151,4.3-5.64c0.969-2.486,1.453-5.154,1.453-8.002 c0-2.354-0.38-4.48-1.139-6.38c-0.761-1.898-2.004-3.418-3.731-4.557C438.451,985.679,436.428,985.109,434.113,985.109z"/> <path fill="#101010" d="M524.85,1009.83c-0.191,1.519-0.646,4.31-1.367,8.373l-1.481,9.113c-5.962,1.442-11.79,2.164-17.486,2.164 c-4.14,0-7.767-0.418-10.88-1.253c-3.684-0.986-6.986-2.733-9.91-5.24c-3-2.582-5.184-5.639-6.551-9.17 c-1.633-4.139-2.449-8.772-2.449-13.898c0-4.708,0.797-9.246,2.393-13.613c1.595-4.366,3.949-7.965,7.063-10.794 c3.113-2.828,6.569-4.728,10.367-5.695c3.797-0.969,7.992-1.453,12.588-1.453c2.695,0,5.411,0.143,8.145,0.428 c2.734,0.284,6.114,0.902,10.14,1.851l0.114,1.31c0.113,1.367,0.199,2.764,0.256,4.188s0.18,3.674,0.37,6.749l0.342,5.069 c-5.431-1.898-10.233-2.848-14.411-2.848c-3,0-5.63,0.579-7.889,1.737c-2.26,1.159-3.93,2.829-5.012,5.013 c-1.083,2.184-1.624,4.719-1.624,7.604c0,2.925,0.484,5.374,1.452,7.348c0.969,1.976,2.516,3.456,4.643,4.443 c2.127,0.988,4.461,1.48,7.006,1.48c1.291,0,2.82-0.132,4.586-0.398c1.766-0.265,3.303-0.56,4.613-0.883 C521.176,1011.131,522.836,1010.59,524.85,1009.83z"/> <path fill="#101010" d="M534.045,1028c0.527-4.86,0.905-8.81,1.131-11.848c0.303-4.139,0.604-9.321,0.906-15.55l0.621-13.5 c0.264-6.113,0.453-11.961,0.566-17.543c0.15-6.683,0.227-13.12,0.227-19.31c5.32,0.076,9.313,0.114,11.974,0.114 c3.079,0,6.728-0.038,10.948-0.114c-0.88,9.949-1.682,22.31-2.408,37.081s-1.09,28.328-1.09,40.669 c-4.4-0.075-8.117-0.114-11.152-0.114C542.276,1027.886,538.369,1027.925,534.045,1028z M559.164,995.276l9.797-14.109 l7.348-11.323c5.24,0.077,9.209,0.114,11.905,0.114c3.721,0,8.126-0.037,13.214-0.114l-11.334,14.737 c-2.658,3.375-5.374,7.017-8.146,10.924c2.657,4.902,9.057,15.734,19.195,32.495c-4.442-0.075-8.45-0.114-12.019-0.114 c-3.646,0-7.823,0.039-12.531,0.114l-3.531-7.126c-1.254-2.471-2.336-4.542-3.246-6.214c-0.342-0.684-2.943-5.34-7.805-13.968 L559.164,995.276z"/> </g> </svg>原来就是一个Xml文档.
在Wpf中我们需要的其实是路径信息, 这个Xml文档一看就知道 ,我们需要的其实是polygon标签和path标签的内容.好的 我们将其复制下来.
3.在Blend中编辑并在WPF中使用
在Blend中新建一个UserControl ,在Grid中粘贴我们拷贝的路径代码:
<polygon fill="#101010" points="382.258,914.655 376.335,908.732 341.414,943.75 353.227,943.75 "/> <polygon fill="#101010" points="325.899,927.681 337.743,927.68 366.514,898.911 360.591,892.988 "/> <polygon fill="#101010" points="391.373,923.771 348.227,966.916 308.328,927.021 351.477,883.874 351.364,883.762 286.336,893.748 286.352,1003.748 316.353,1033.811 316.383,990.787 361.383,983.739 361.341,1033.754 391.347,1033.775 391.359,988.78 371.371,968.799 391.384,948.765 391.394,923.791 "/> <path fill="#101010" d="M279.305,1006.818l0.068-63.068l-258.172,0.047l-4.865,89.959l290.132-0.002L279.305,1006.818z M92.208,952.799c-0.038,0.449-0.133,2.084-0.283,4.9l-0.339,6.143c-0.076,1.314-0.113,2.648-0.113,4 c-7.274-0.301-13.379-0.453-18.316-0.453c-5.427,0-9.093,0.01-10.995,0.029c-1.904,0.02-4.872,0.104-8.904,0.254l-0.687,13.002 c4.449,0.113,9.632,0.17,15.55,0.17c2.111,0,7.728-0.131,16.851-0.396c-0.377,4.825-0.735,10.571-1.073,17.241 c-6.517-0.074-11.526-0.113-15.028-0.113c-5.198,0-11.018,0.133-17.458,0.396l-0.672,13.736h6.497c1.92,0,5.894-0.055,11.92-0.168 l11.695-0.283c1.732-0.037,4.632-0.188,8.7-0.453c-0.452,5.578-0.829,11.346-1.13,17.299c-9.196-0.074-19.277-0.113-30.244-0.113 l-24.874,0.057l-8.027,0.057c0.944-9.723,1.634-17.863,2.069-24.422c0.435-6.557,0.869-15.271,1.304-26.145 s0.652-18.08,0.652-21.623l-0.057-4.975c8.892,0.075,19.65,0.112,32.274,0.112c11.644,0,21.911-0.037,30.804-0.112L92.208,952.799z M159.659,999.047c-0.563,7.387-0.997,17.072-1.297,29.057c-3.696-0.074-7.372-0.113-11.03-0.113c-3.544,0-7.315,0.039-11.313,0.113 c0.514-4.145,1.085-12.699,1.71-25.664c-1.429,0.678-2.547,1.168-3.356,1.469c-0.809,0.303-2.229,0.754-4.258,1.357 s-3.619,1.111-4.765,1.525c-1.147,0.416-2.143,0.943-2.989,1.584s-1.448,1.299-1.805,1.979c-0.357,0.678-0.535,1.432-0.535,2.262 c0,1.281,0.509,2.373,1.526,3.277s2.637,1.357,4.862,1.357c0.791,0,1.639-0.064,2.543-0.197c0.905-0.133,2.148-0.461,3.731-0.99 c-1.094,2.902-2.394,7.143-3.901,12.721c-3.242,0.527-6.313,0.791-9.214,0.791c-4.674,0-8.564-0.65-11.674-1.951 c-3.109-1.299-5.503-3.4-7.18-6.303c-1.677-2.902-2.516-5.803-2.516-8.705c0-1.771,0.31-3.506,0.932-5.201 c0.622-1.697,1.592-3.354,2.91-4.975c1.318-1.621,2.863-3.006,4.634-4.156c1.771-1.148,4.191-2.232,7.262-3.25 s6.959-1.979,11.669-2.883c1.959-0.377,3.757-0.782,5.397-1.216c1.639-0.433,2.806-0.81,3.503-1.13 c0.697-0.32,1.263-0.697,1.695-1.131s0.744-0.885,0.933-1.357c0.188-0.471,0.283-0.97,0.283-1.498c0-1.432-0.603-2.534-1.808-3.307 c-1.206-0.771-2.976-1.159-5.311-1.159c-6.48,0-14.484,1.829-24.015,5.483c0.716-3.73,1.168-6.303,1.357-7.717 c0.188-1.412,0.489-3.627,0.904-6.643c10.854-2.373,20.183-3.561,27.986-3.561c4.447,0,8.519,0.5,12.212,1.498 s6.578,2.609,8.651,4.833c2.073,2.224,3.11,5.409,3.11,9.554C160.505,986.912,160.222,991.66,159.659,999.047z M196,988.984 c0.15,0.377,0.424,0.773,0.819,1.188c0.396,0.414,0.885,0.839,1.47,1.271c0.584,0.434,2.007,1.441,4.269,3.025 c2.261,1.582,4.032,2.883,5.314,3.9c2.11,1.658,3.721,3.193,4.833,4.607c1.111,1.412,1.959,2.92,2.544,4.521 c0.584,1.604,0.876,3.289,0.876,5.061c0,2.676-0.65,5.135-1.95,7.377c-1.3,2.242-3.26,4.117-5.879,5.625 c-2.62,1.508-5.456,2.553-8.508,3.137c-3.053,0.584-6.2,0.877-9.441,0.877c-2.186,0-4.928-0.189-8.225-0.566 c-3.298-0.377-7.133-1.035-11.504-1.979c-0.151-1.658-0.302-3.4-0.452-5.229c-0.151-1.828-0.396-4.344-0.735-7.547l-0.452-4.07 c3.647,1.434,6.786,2.498,9.418,3.193c2.632,0.699,5.057,1.047,7.276,1.047c1.842,0,3.337-0.17,4.483-0.51 c1.146-0.338,1.984-0.828,2.51-1.469c0.527-0.641,0.79-1.301,0.79-1.979c0-0.604-0.198-1.197-0.592-1.781 c-0.395-0.584-1.288-1.385-2.678-2.402c-3.082-2.262-5.797-4.314-8.146-6.162c-2.35-1.846-4.116-3.486-5.3-4.918 s-2.085-2.977-2.706-4.636c-0.62-1.658-0.93-3.372-0.93-5.145c0-3.128,0.895-6.049,2.686-8.763c1.79-2.713,4.428-4.682,7.914-5.907 c3.486-1.224,7.735-1.837,12.748-1.837c5.238,0,11.928,0.678,20.068,2.035l0.905,15.828c-4.561-1.809-8.952-2.713-13.172-2.713 c-2.978,0-5.136,0.307-6.473,0.918c-1.338,0.613-2.007,1.551-2.007,2.813C195.773,988.213,195.848,988.607,196,988.984z M255.604,1009.506c0.396,1.205,1.094,2.072,2.093,2.6c0.999,0.529,2.103,0.791,3.309,0.791c0.905,0,1.849-0.064,2.829-0.197 c0.98-0.131,2.714-0.537,5.203-1.215c-0.679,3.166-1.263,6.256-1.753,9.271l-1.243,6.896c-3.731,0.828-6.643,1.355-8.734,1.582 s-4.118,0.34-6.077,0.34c-3.204,0-6.049-0.273-8.536-0.82s-4.561-1.545-6.218-2.996c-1.659-1.451-2.79-3.117-3.392-5.002 c-0.603-1.885-0.904-3.883-0.904-5.994c0-0.375,0.019-1.045,0.056-2.006s0.168-3.1,0.394-6.416l1.236-19.561h-8.808 c0.187-2.6,0.357-6.029,0.508-10.289l0.169-5.257h9.368c0.224-1.733,0.505-5.521,0.843-11.362l9.677-1.979 c1.773-0.34,5.545-1.206,11.319-2.602c-0.265,4.938-0.454,10.252-0.567,15.942h12.891c-0.302,7.839-0.451,13.022-0.451,15.546 h-13.007l-0.681,14.133c-0.076,2.111-0.113,3.469-0.113,4.07C255.011,1006.791,255.209,1008.299,255.604,1009.506z"/> <path fill="#101010" d="M434.512,968.363c4.707,0,9.236,0.722,13.584,2.164c4.348,1.443,8.021,3.523,11.021,6.237 c3,2.716,5.213,5.887,6.637,9.513s2.136,7.528,2.136,11.705c0,4.063-0.636,7.927-1.908,11.591 c-1.272,3.665-3.427,7.102-6.465,10.31c-3.038,3.21-6.901,5.611-11.591,7.206c-4.691,1.595-9.655,2.392-14.896,2.392 c-4.823,0-9.455-0.702-13.897-2.107c-4.443-1.404-8.156-3.454-11.137-6.151c-2.98-2.695-5.221-5.924-6.721-9.683 c-1.5-3.76-2.25-7.709-2.25-11.848s0.73-8.089,2.193-11.848c1.461-3.76,3.777-7.139,6.949-10.139c3.17-3,7.091-5.307,11.762-6.921 S429.461,968.363,434.512,968.363z M434.113,985.109c-2.432,0-4.596,0.627-6.494,1.88s-3.332,3.085-4.301,5.496 c-0.968,2.412-1.452,5.041-1.452,7.89c0,4.177,1.044,7.376,3.133,9.598c2.088,2.221,4.708,3.332,7.86,3.332 c2.393,0,4.537-0.636,6.437-1.908c1.898-1.272,3.332-3.151,4.3-5.64c0.969-2.486,1.453-5.154,1.453-8.002 c0-2.354-0.38-4.48-1.139-6.38c-0.761-1.898-2.004-3.418-3.731-4.557C438.451,985.679,436.428,985.109,434.113,985.109z"/> <path fill="#101010" d="M524.85,1009.83c-0.191,1.519-0.646,4.31-1.367,8.373l-1.481,9.113c-5.962,1.442-11.79,2.164-17.486,2.164 c-4.14,0-7.767-0.418-10.88-1.253c-3.684-0.986-6.986-2.733-9.91-5.24c-3-2.582-5.184-5.639-6.551-9.17 c-1.633-4.139-2.449-8.772-2.449-13.898c0-4.708,0.797-9.246,2.393-13.613c1.595-4.366,3.949-7.965,7.063-10.794 c3.113-2.828,6.569-4.728,10.367-5.695c3.797-0.969,7.992-1.453,12.588-1.453c2.695,0,5.411,0.143,8.145,0.428 c2.734,0.284,6.114,0.902,10.14,1.851l0.114,1.31c0.113,1.367,0.199,2.764,0.256,4.188s0.18,3.674,0.37,6.749l0.342,5.069 c-5.431-1.898-10.233-2.848-14.411-2.848c-3,0-5.63,0.579-7.889,1.737c-2.26,1.159-3.93,2.829-5.012,5.013 c-1.083,2.184-1.624,4.719-1.624,7.604c0,2.925,0.484,5.374,1.452,7.348c0.969,1.976,2.516,3.456,4.643,4.443 c2.127,0.988,4.461,1.48,7.006,1.48c1.291,0,2.82-0.132,4.586-0.398c1.766-0.265,3.303-0.56,4.613-0.883 C521.176,1011.131,522.836,1010.59,524.85,1009.83z"/> <path fill="#101010" d="M534.045,1028c0.527-4.86,0.905-8.81,1.131-11.848c0.303-4.139,0.604-9.321,0.906-15.55l0.621-13.5 c0.264-6.113,0.453-11.961,0.566-17.543c0.15-6.683,0.227-13.12,0.227-19.31c5.32,0.076,9.313,0.114,11.974,0.114 c3.079,0,6.728-0.038,10.948-0.114c-0.88,9.949-1.682,22.31-2.408,37.081s-1.09,28.328-1.09,40.669 c-4.4-0.075-8.117-0.114-11.152-0.114C542.276,1027.886,538.369,1027.925,534.045,1028z M559.164,995.276l9.797-14.109 l7.348-11.323c5.24,0.077,9.209,0.114,11.905,0.114c3.721,0,8.126-0.037,13.214-0.114l-11.334,14.737 c-2.658,3.375-5.374,7.017-8.146,10.924c2.657,4.902,9.057,15.734,19.195,32.495c-4.442-0.075-8.45-0.114-12.019-0.114 c-3.646,0-7.823,0.039-12.531,0.114l-3.531-7.126c-1.254-2.471-2.336-4.542-3.246-6.214c-0.342-0.684-2.943-5.34-7.805-13.968 L559.164,995.276z"/>将标签和属性改成WPF中相应的字母: 比如将标签首字母大写, Path的d改成Data等等,修改后就像下面这样:
<UserControl x:Class="WpfApplication1.UserControl3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:WpfApplication1" > <Grid> <Polygon Fill="Black" Points="382.258,914.655 376.335,908.732 341.414,943.75 353.227,943.75 "/> <Polygon Fill="Black" Points="325.899,927.681 337.743,927.68 366.514,898.911 360.591,892.988 "/> <Polygon Fill="Black" Points="391.373,923.771 348.227,966.916 308.328,927.021 351.477,883.874 351.364,883.762 286.336,893.748 286.352,1003.748 316.353,1033.811 316.383,990.787 361.383,983.739 361.341,1033.754 391.347,1033.775 391.359,988.78 371.371,968.799 391.384,948.765 391.394,923.791 "/> <Path Fill="Black" Data="M279.305,1006.818l0.068-63.068l-258.172,0.047l-4.865,89.959l290.132-0.002L279.305,1006.818z M92.208,952.799c-0.038,0.449-0.133,2.084-0.283,4.9l-0.339,6.143c-0.076,1.314-0.113,2.648-0.113,4 c-7.274-0.301-13.379-0.453-18.316-0.453c-5.427,0-9.093,0.01-10.995,0.029c-1.904,0.02-4.872,0.104-8.904,0.254l-0.687,13.002 c4.449,0.113,9.632,0.17,15.55,0.17c2.111,0,7.728-0.131,16.851-0.396c-0.377,4.825-0.735,10.571-1.073,17.241 c-6.517-0.074-11.526-0.113-15.028-0.113c-5.198,0-11.018,0.133-17.458,0.396l-0.672,13.736h6.497c1.92,0,5.894-0.055,11.92-0.168 l11.695-0.283c1.732-0.037,4.632-0.188,8.7-0.453c-0.452,5.578-0.829,11.346-1.13,17.299c-9.196-0.074-19.277-0.113-30.244-0.113 l-24.874,0.057l-8.027,0.057c0.944-9.723,1.634-17.863,2.069-24.422c0.435-6.557,0.869-15.271,1.304-26.145 s0.652-18.08,0.652-21.623l-0.057-4.975c8.892,0.075,19.65,0.112,32.274,0.112c11.644,0,21.911-0.037,30.804-0.112L92.208,952.799z M159.659,999.047c-0.563,7.387-0.997,17.072-1.297,29.057c-3.696-0.074-7.372-0.113-11.03-0.113c-3.544,0-7.315,0.039-11.313,0.113 c0.514-4.145,1.085-12.699,1.71-25.664c-1.429,0.678-2.547,1.168-3.356,1.469c-0.809,0.303-2.229,0.754-4.258,1.357 s-3.619,1.111-4.765,1.525c-1.147,0.416-2.143,0.943-2.989,1.584s-1.448,1.299-1.805,1.979c-0.357,0.678-0.535,1.432-0.535,2.262 c0,1.281,0.509,2.373,1.526,3.277s2.637,1.357,4.862,1.357c0.791,0,1.639-0.064,2.543-0.197c0.905-0.133,2.148-0.461,3.731-0.99 c-1.094,2.902-2.394,7.143-3.901,12.721c-3.242,0.527-6.313,0.791-9.214,0.791c-4.674,0-8.564-0.65-11.674-1.951 c-3.109-1.299-5.503-3.4-7.18-6.303c-1.677-2.902-2.516-5.803-2.516-8.705c0-1.771,0.31-3.506,0.932-5.201 c0.622-1.697,1.592-3.354,2.91-4.975c1.318-1.621,2.863-3.006,4.634-4.156c1.771-1.148,4.191-2.232,7.262-3.25 s6.959-1.979,11.669-2.883c1.959-0.377,3.757-0.782,5.397-1.216c1.639-0.433,2.806-0.81,3.503-1.13 c0.697-0.32,1.263-0.697,1.695-1.131s0.744-0.885,0.933-1.357c0.188-0.471,0.283-0.97,0.283-1.498c0-1.432-0.603-2.534-1.808-3.307 c-1.206-0.771-2.976-1.159-5.311-1.159c-6.48,0-14.484,1.829-24.015,5.483c0.716-3.73,1.168-6.303,1.357-7.717 c0.188-1.412,0.489-3.627,0.904-6.643c10.854-2.373,20.183-3.561,27.986-3.561c4.447,0,8.519,0.5,12.212,1.498 s6.578,2.609,8.651,4.833c2.073,2.224,3.11,5.409,3.11,9.554C160.505,986.912,160.222,991.66,159.659,999.047z M196,988.984 c0.15,0.377,0.424,0.773,0.819,1.188c0.396,0.414,0.885,0.839,1.47,1.271c0.584,0.434,2.007,1.441,4.269,3.025 c2.261,1.582,4.032,2.883,5.314,3.9c2.11,1.658,3.721,3.193,4.833,4.607c1.111,1.412,1.959,2.92,2.544,4.521 c0.584,1.604,0.876,3.289,0.876,5.061c0,2.676-0.65,5.135-1.95,7.377c-1.3,2.242-3.26,4.117-5.879,5.625 c-2.62,1.508-5.456,2.553-8.508,3.137c-3.053,0.584-6.2,0.877-9.441,0.877c-2.186,0-4.928-0.189-8.225-0.566 c-3.298-0.377-7.133-1.035-11.504-1.979c-0.151-1.658-0.302-3.4-0.452-5.229c-0.151-1.828-0.396-4.344-0.735-7.547l-0.452-4.07 c3.647,1.434,6.786,2.498,9.418,3.193c2.632,0.699,5.057,1.047,7.276,1.047c1.842,0,3.337-0.17,4.483-0.51 c1.146-0.338,1.984-0.828,2.51-1.469c0.527-0.641,0.79-1.301,0.79-1.979c0-0.604-0.198-1.197-0.592-1.781 c-0.395-0.584-1.288-1.385-2.678-2.402c-3.082-2.262-5.797-4.314-8.146-6.162c-2.35-1.846-4.116-3.486-5.3-4.918 s-2.085-2.977-2.706-4.636c-0.62-1.658-0.93-3.372-0.93-5.145c0-3.128,0.895-6.049,2.686-8.763c1.79-2.713,4.428-4.682,7.914-5.907 c3.486-1.224,7.735-1.837,12.748-1.837c5.238,0,11.928,0.678,20.068,2.035l0.905,15.828c-4.561-1.809-8.952-2.713-13.172-2.713 c-2.978,0-5.136,0.307-6.473,0.918c-1.338,0.613-2.007,1.551-2.007,2.813C195.773,988.213,195.848,988.607,196,988.984z M255.604,1009.506c0.396,1.205,1.094,2.072,2.093,2.6c0.999,0.529,2.103,0.791,3.309,0.791c0.905,0,1.849-0.064,2.829-0.197 c0.98-0.131,2.714-0.537,5.203-1.215c-0.679,3.166-1.263,6.256-1.753,9.271l-1.243,6.896c-3.731,0.828-6.643,1.355-8.734,1.582 s-4.118,0.34-6.077,0.34c-3.204,0-6.049-0.273-8.536-0.82s-4.561-1.545-6.218-2.996c-1.659-1.451-2.79-3.117-3.392-5.002 c-0.603-1.885-0.904-3.883-0.904-5.994c0-0.375,0.019-1.045,0.056-2.006s0.168-3.1,0.394-6.416l1.236-19.561h-8.808 c0.187-2.6,0.357-6.029,0.508-10.289l0.169-5.257h9.368c0.224-1.733,0.505-5.521,0.843-11.362l9.677-1.979 c1.773-0.34,5.545-1.206,11.319-2.602c-0.265,4.938-0.454,10.252-0.567,15.942h12.891c-0.302,7.839-0.451,13.022-0.451,15.546 h-13.007l-0.681,14.133c-0.076,2.111-0.113,3.469-0.113,4.07C255.011,1006.791,255.209,1008.299,255.604,1009.506z"/> <Path Fill="Black" Data="M434.512,968.363c4.707,0,9.236,0.722,13.584,2.164c4.348,1.443,8.021,3.523,11.021,6.237 c3,2.716,5.213,5.887,6.637,9.513s2.136,7.528,2.136,11.705c0,4.063-0.636,7.927-1.908,11.591 c-1.272,3.665-3.427,7.102-6.465,10.31c-3.038,3.21-6.901,5.611-11.591,7.206c-4.691,1.595-9.655,2.392-14.896,2.392 c-4.823,0-9.455-0.702-13.897-2.107c-4.443-1.404-8.156-3.454-11.137-6.151c-2.98-2.695-5.221-5.924-6.721-9.683 c-1.5-3.76-2.25-7.709-2.25-11.848s0.73-8.089,2.193-11.848c1.461-3.76,3.777-7.139,6.949-10.139c3.17-3,7.091-5.307,11.762-6.921 S429.461,968.363,434.512,968.363z M434.113,985.109c-2.432,0-4.596,0.627-6.494,1.88s-3.332,3.085-4.301,5.496 c-0.968,2.412-1.452,5.041-1.452,7.89c0,4.177,1.044,7.376,3.133,9.598c2.088,2.221,4.708,3.332,7.86,3.332 c2.393,0,4.537-0.636,6.437-1.908c1.898-1.272,3.332-3.151,4.3-5.64c0.969-2.486,1.453-5.154,1.453-8.002 c0-2.354-0.38-4.48-1.139-6.38c-0.761-1.898-2.004-3.418-3.731-4.557C438.451,985.679,436.428,985.109,434.113,985.109z"/> <Path Fill="Black" Data="M524.85,1009.83c-0.191,1.519-0.646,4.31-1.367,8.373l-1.481,9.113c-5.962,1.442-11.79,2.164-17.486,2.164 c-4.14,0-7.767-0.418-10.88-1.253c-3.684-0.986-6.986-2.733-9.91-5.24c-3-2.582-5.184-5.639-6.551-9.17 c-1.633-4.139-2.449-8.772-2.449-13.898c0-4.708,0.797-9.246,2.393-13.613c1.595-4.366,3.949-7.965,7.063-10.794 c3.113-2.828,6.569-4.728,10.367-5.695c3.797-0.969,7.992-1.453,12.588-1.453c2.695,0,5.411,0.143,8.145,0.428 c2.734,0.284,6.114,0.902,10.14,1.851l0.114,1.31c0.113,1.367,0.199,2.764,0.256,4.188s0.18,3.674,0.37,6.749l0.342,5.069 c-5.431-1.898-10.233-2.848-14.411-2.848c-3,0-5.63,0.579-7.889,1.737c-2.26,1.159-3.93,2.829-5.012,5.013 c-1.083,2.184-1.624,4.719-1.624,7.604c0,2.925,0.484,5.374,1.452,7.348c0.969,1.976,2.516,3.456,4.643,4.443 c2.127,0.988,4.461,1.48,7.006,1.48c1.291,0,2.82-0.132,4.586-0.398c1.766-0.265,3.303-0.56,4.613-0.883 C521.176,1011.131,522.836,1010.59,524.85,1009.83z"/> <Path Fill="Black" Data="M534.045,1028c0.527-4.86,0.905-8.81,1.131-11.848c0.303-4.139,0.604-9.321,0.906-15.55l0.621-13.5 c0.264-6.113,0.453-11.961,0.566-17.543c0.15-6.683,0.227-13.12,0.227-19.31c5.32,0.076,9.313,0.114,11.974,0.114 c3.079,0,6.728-0.038,10.948-0.114c-0.88,9.949-1.682,22.31-2.408,37.081s-1.09,28.328-1.09,40.669 c-4.4-0.075-8.117-0.114-11.152-0.114C542.276,1027.886,538.369,1027.925,534.045,1028z M559.164,995.276l9.797-14.109 l7.348-11.323c5.24,0.077,9.209,0.114,11.905,0.114c3.721,0,8.126-0.037,13.214-0.114l-11.334,14.737 c-2.658,3.375-5.374,7.017-8.146,10.924c2.657,4.902,9.057,15.734,19.195,32.495c-4.442-0.075-8.45-0.114-12.019-0.114 c-3.646,0-7.823,0.039-12.531,0.114l-3.531-7.126c-1.254-2.471-2.336-4.542-3.246-6.214c-0.342-0.684-2.943-5.34-7.805-13.968 L559.164,995.276z"/> </Grid> </UserControl>
这是再看Blend的设计预览界面,就可以看到里面的图形了
但是可能你们已发现了一个问题 就是我们需要的图形是下面的部分,而上面很大一部分空白区域并不是我们想要的,此时可以这样来消除:
在blend中[对象和时间线]菜单中将我们需要的图形都选中,并将其合并:
合并后效果:
此时代码变成了这样:
<UserControl x:Class="WpfApplication1.UserControl3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:WpfApplication1" > <Grid> <Path Data="M417.77701,101.34698 C415.345,101.34698 413.181,101.974 411.28299,103.22699 409.38501,104.47998 407.95099,106.31195 406.98199,108.72296 406.01401,111.13495 405.53,113.76398 405.53,116.61298 405.53,120.78998 406.574,123.98895 408.66299,126.211 410.75101,128.43195 413.371,129.54297 416.52301,129.54297 418.91601,129.54297 421.06,128.90698 422.95999,127.63495 424.858,126.36298 426.29199,124.48395 427.26001,121.995 428.229,119.50897 428.71301,116.841 428.71301,113.99298 428.71301,111.63898 428.33301,109.513 427.574,107.61298 426.81299,105.71497 425.57001,104.19495 423.84299,103.05597 422.11499,101.91699 420.09201,101.34698 417.77701,101.34698 z M559.97302,86.08197 C565.21301,86.158997 569.182,86.195984 571.87799,86.195984 575.599,86.195984 580.00403,86.158997 585.09198,86.08197 L573.75799,100.81897 C571.09997,104.19397 568.38397,107.836 565.612,111.74298 568.26898,116.64496 574.669,127.47699 584.807,144.23798 580.36499,144.16302 576.35699,144.12396 572.78802,144.12396 569.14203,144.12396 564.96502,144.16302 560.25702,144.23798 L556.72601,137.112 C555.47198,134.64099 554.39001,132.56995 553.47998,130.89795 553.138,130.21399 550.53699,125.55798 545.67499,116.92999 L542.828,111.51398 552.625,97.404968 z M120.19301,85.152954 C112.39,85.152954 103.061,86.341003 92.206999,88.713989 91.791998,91.72998 91.491003,93.944946 91.302999,95.356995 91.113997,96.770996 90.662001,99.343994 89.945997,103.07397 99.477003,99.419983 107.481,97.591003 113.961,97.591003 116.296,97.591003 118.06599,97.979004 119.272,98.75 120.477,99.522949 121.08,100.625 121.08,102.05695 121.08,102.58496 120.985,103.08398 120.797,103.55499 120.608,104.02698 120.296,104.47797 119.864,104.91199 119.432,105.34595 118.866,105.72296 118.169,106.04297 117.472,106.36298 116.30501,106.73999 114.666,107.17297 113.026,107.60699 111.228,108.01196 109.269,108.38898 104.559,109.29297 100.671,110.25397 97.599997,111.27197 94.528997,112.28998 92.108999,113.37396 90.338003,114.52197 88.566999,115.672 87.022001,117.05695 85.704,118.67798 84.386,120.29895 83.415998,121.95599 82.793997,123.65295 82.172003,125.34796 81.861998,127.08295 81.861998,128.854 81.861998,131.75598 82.701002,134.65698 84.377996,137.55896 86.054998,140.46198 88.449003,142.56293 91.557997,143.862 94.667997,145.16302 98.557997,145.81293 103.232,145.81293 106.133,145.81293 109.204,145.54901 112.446,145.02203 113.953,139.44397 115.253,135.203 116.347,132.30096 114.76401,132.82996 113.52099,133.15796 112.616,133.29095 111.712,133.42395 110.864,133.48798 110.073,133.48798 107.848,133.48798 106.228,133.03497 105.211,132.13098 104.194,131.22699 103.685,130.13495 103.685,128.854 103.685,128.02399 103.863,127.26996 104.22,126.59198 104.577,125.91199 105.179,125.25397 106.02501,124.61298 106.871,123.97198 107.867,123.44495 109.014,123.02899 110.16,122.61499 111.75,122.10699 113.77901,121.50397 115.808,120.901 117.22799,120.44995 118.037,120.14697 118.84601,119.84595 119.964,119.35596 121.393,118.67798 120.768,131.64301 120.197,140.19696 119.683,144.34198 123.681,144.26801 127.45199,144.22894 130.996,144.22894 134.65401,144.22894 138.33,144.26801 142.026,144.34198 142.326,132.35699 142.75999,122.672 143.323,115.28497 143.886,107.89795 144.169,103.14996 144.166,101.03796 144.166,96.893005 143.129,93.707947 141.056,91.483948 138.983,89.259949 136.09801,87.648987 132.405,86.651001 128.712,85.652954 124.64,85.152954 120.19301,85.152954 z M180.116,85.151001 C175.10299,85.151001 170.854,85.763977 167.36799,86.987976 163.882,88.212952 161.244,90.181946 159.45399,92.894958 157.66299,95.608948 156.768,98.529968 156.768,101.65796 156.768,103.43097 157.078,105.14496 157.698,106.80298 158.319,108.46198 159.22,110.00696 160.40401,111.43896 161.588,112.87097 163.354,114.51099 165.70399,116.35699 168.05301,118.20496 170.768,120.25696 173.85,122.51898 175.24,123.53595 176.13299,124.33698 176.528,124.92096 176.922,125.505 177.11999,126.09796 177.11999,126.70197 177.11999,127.38 176.85699,128.03998 176.33,128.68097 175.804,129.32196 174.966,129.81195 173.82001,130.14996 172.67399,130.48999 171.179,130.65997 169.337,130.65997 167.11799,130.65997 164.69301,130.31195 162.061,129.61298 159.429,128.91797 156.29001,127.854 152.643,126.41998 L153.095,130.48999 C153.434,133.69299 153.679,136.20898 153.83,138.03699 153.97999,139.86597 154.13099,141.60797 154.282,143.26593 158.653,144.21002 162.488,144.86798 165.78599,145.24493 169.08301,145.62201 171.825,145.81097 174.011,145.81097 177.252,145.81097 180.399,145.51801 183.45199,144.93402 186.504,144.35004 189.33999,143.30499 191.96,141.79694 194.57899,140.289 196.539,138.414 197.839,136.172 199.13901,133.92999 199.789,131.47095 199.789,128.79498 199.789,127.02295 199.49699,125.33795 198.91299,123.73395 198.328,122.133 197.47999,120.625 196.369,119.21295 195.257,117.79895 193.64599,116.26398 191.53599,114.60596 190.254,113.58899 188.483,112.28796 186.222,110.70599 183.96,109.12195 182.537,108.11499 181.953,107.68097 181.36799,107.24896 180.879,106.82397 180.483,106.40997 180.088,105.995 179.81399,105.599 179.664,105.22198 179.51201,104.84497 179.43699,104.45099 179.43699,104.03198 179.43699,102.76996 180.106,101.83197 181.444,101.21899 182.781,100.60797 184.93899,100.30096 187.91701,100.30096 192.13701,100.30096 196.528,101.20496 201.089,103.01398 L200.184,87.185974 C192.044,85.828979 185.354,85.151001 180.116,85.151001 z M490.80099,84.60199 C493.496,84.60199 496.21197,84.744995 498.94598,85.029968 501.67999,85.313965 505.06,85.931946 509.086,86.880981 L509.20001,88.190979 C509.31299,89.557983 509.39898,90.954956 509.45599,92.378967 509.513,93.802979 509.63598,96.052979 509.82599,99.127991 L510.16803,104.19696 C504.737,102.29895 499.935,101.349 495.75702,101.349 492.75699,101.349 490.12701,101.92798 487.86801,103.086 485.608,104.245 483.93799,105.91498 482.85599,108.099 481.77301,110.28296 481.23199,112.81799 481.23199,115.703 481.23199,118.62799 481.716,121.07697 482.68399,123.05096 483.65301,125.02698 485.20001,126.50696 487.32699,127.49396 489.45401,128.48199 491.78799,128.974 494.33301,128.974 495.62399,128.974 497.15301,128.84198 498.919,128.57599 500.685,128.31097 502.22198,128.01599 503.53198,127.69299 504.84002,127.36896 506.5,126.828 508.51398,126.06799 508.323,127.58698 507.86798,130.37799 507.14697,134.44098 L505.66601,143.55402 C499.70398,144.99603 493.87601,145.71796 488.17999,145.71796 484.04001,145.71796 480.41299,145.29999 477.29999,144.46503 473.616,143.47894 470.31399,141.73199 467.39001,139.22498 464.39001,136.64301 462.20599,133.586 460.83899,130.05499 459.20599,125.91595 458.39001,121.28296 458.39001,116.15698 458.39001,111.44897 459.18701,106.91095 460.78299,102.54401 462.37799,98.177979 464.73199,94.578979 467.84601,91.75 470.95901,88.921997 474.41501,87.021973 478.21301,86.054993 482.01001,85.085999 486.20498,84.60199 490.80099,84.60199 z M418.17599,84.600952 C422.88299,84.600952 427.41199,85.322998 431.76001,86.764954 436.108,88.207947 439.781,90.287964 442.781,93.001953 445.781,95.717957 447.99399,98.888977 449.418,102.51495 450.84201,106.14099 451.55401,110.04297 451.55401,114.21997 451.55401,118.28296 450.918,122.14697 449.64599,125.81097 448.37399,129.47595 446.21899,132.91296 443.181,136.12097 440.143,139.33099 436.28,141.73199 431.58999,143.32697 426.89898,144.92194 421.935,145.71893 416.694,145.71893 411.871,145.71893 407.23901,145.01703 402.797,143.612 398.354,142.20795 394.64099,140.15796 391.66,137.461 388.67999,134.76599 386.43899,131.53699 384.93899,127.77795 383.43899,124.01801 382.68899,120.06897 382.68899,115.92999 382.68899,111.79095 383.419,107.841 384.88199,104.08197 386.34299,100.32196 388.65899,96.942993 391.83099,93.942993 395.00101,90.942993 398.922,88.635986 403.59299,87.021973 408.26401,85.407959 413.125,84.600952 418.17599,84.600952 z M240.60699,71.527954 C234.83301,72.92395 231.061,73.789978 229.28799,74.130005 L219.61101,76.108948 C219.27299,81.949951 218.992,85.737976 218.768,87.470947 L209.39999,87.470947 209.231,92.727966 C209.08,96.987976 208.91,100.41699 208.72301,103.01697 L217.531,103.01697 216.295,122.578 C216.069,125.89398 215.938,128.03296 215.901,128.99396 215.864,129.95496 215.845,130.625 215.845,131 215.845,133.11096 216.14599,135.10895 216.74901,136.99396 217.351,138.87897 218.48199,140.54498 220.141,141.99603 221.798,143.44696 223.87199,144.44501 226.35901,144.992 228.84601,145.539 231.69099,145.81195 234.895,145.81195 236.854,145.81195 238.88099,145.69904 240.97201,145.47198 243.06299,145.24493 245.975,144.71796 249.70599,143.88995 L250.949,136.99396 C251.43899,133.979 252.02301,130.88898 252.70199,127.72296 250.21301,128.401 248.479,128.80695 247.49899,128.93799 246.51901,129.07098 245.57501,129.13495 244.67001,129.13495 243.46399,129.13495 242.36001,128.87299 241.36099,128.34399 240.362,127.81598 239.664,126.94897 239.268,125.74396 238.873,124.53699 238.675,123.02899 238.679,121.21899 238.679,120.61798 238.716,119.25995 238.79201,117.14899 L239.47301,103.01599 252.48001,103.01599 C252.48001,100.492 252.629,95.30896 252.931,87.469971 L240.04001,87.469971 C240.15301,81.779968 240.34201,76.466003 240.60699,71.527954 z M12.910002,67.177002 L12.967003,72.151978 C12.966999,75.694946 12.75,82.901001 12.315004,93.774963 11.879999,104.64899 11.445999,113.36298 11.010996,119.91998 10.576,126.479 9.8859997,134.61896 8.9420071,144.34198 L16.969,144.28497 41.842989,144.22797 C52.810003,144.22797 62.890997,144.26703 72.086996,144.341 72.387999,138.388 72.764997,132.62 73.217001,127.04199 69.149,127.30695 66.248999,127.45795 64.516996,127.495 L52.821997,127.77795 C46.796,127.89099 42.822001,127.94598 40.902006,127.94598 L34.404993,127.94598 35.076994,114.20996 C41.517,113.94696 47.337,113.81396 52.535002,113.81396 56.037001,113.81396 61.046003,113.85297 67.563002,113.927 67.900999,107.25696 68.259001,101.51099 68.636,96.685974 59.512999,96.950989 53.896002,97.08197 51.785002,97.08197 45.866999,97.08197 40.684,97.024963 36.234991,96.911987 L36.921995,83.909973 C40.954,83.759949 43.921999,83.675964 45.825987,83.656006 47.728003,83.636963 51.394003,83.626953 56.820997,83.626953 61.758001,83.626953 67.862997,83.778992 75.137007,84.079956 75.136999,82.727966 75.174002,81.393982 75.249998,80.079956 L75.589003,73.936951 C75.738997,71.120972 75.833998,69.485962 75.872,69.036987 L75.987997,67.177002 C67.094999,67.251953 56.828001,67.289001 45.183996,67.289001 32.559999,67.289001 21.802,67.251953 12.910002,67.177002 z M521.15997,66.487 C526.47998,66.562988 530.47302,66.600952 533.13397,66.600952 536.21301,66.600952 539.862,66.562988 544.08203,66.487 543.20202,76.435974 542.40002,88.796997 541.67401,103.56799 540.948,118.33899 540.58398,131.896 540.58398,144.237 536.18402,144.16193 532.46698,144.12299 529.432,144.12299 525.94,144.12396 522.03302,144.16302 517.70898,144.23798 518.23602,139.37799 518.61401,135.42798 518.84002,132.38995 519.143,128.25098 519.44403,123.06897 519.74597,116.83997 L520.367,103.33997 C520.63098,97.22699 520.82001,91.378967 520.93298,85.796997 521.08301,79.113953 521.15997,72.677002 521.15997,66.487 z M263.03699,59.987976 L262.96899,123.05597 290.13199,149.992 0,149.99396 4.8650036,60.034973 z M359.99899,24.969971 L365.922,30.893005 336.89099,59.987976 325.078,59.987976 z M344.255,9.2259521 L350.17801,15.148987 321.40701,43.917969 309.56299,43.919006 z M335.02801,0 L335.14099,0.11199951 291.992,43.258972 331.89099,83.153992 375.03699,40.008972 375.05801,40.028992 375.048,65.002991 355.035,85.036987 375.02301,105.01801 375.01098,150.013 345.005,149.992 345.047,99.97699 300.047,107.02496 300.017,150.04901 270.01599,119.98596 270,9.9859619 z" Fill="Black" Margin="16.336,883.762,-16.336,-883.762" Stretch="Fill"/> </Grid> </UserControl>只有一条Path信息了,是不是相当简洁, 载将其中的Margin信息删除,就是我们想要的图形Path信息了.
<Path Data="M417.77701,101.34698 C415.345,101.34698 413.181,101.974 411.28299,103.22699 409.38501,104.47998 407.95099,106.31195 406.98199,108.72296 406.01401,111.13495 405.53,113.76398 405.53,116.61298 405.53,120.78998 406.574,123.98895 408.66299,126.211 410.75101,128.43195 413.371,129.54297 416.52301,129.54297 418.91601,129.54297 421.06,128.90698 422.95999,127.63495 424.858,126.36298 426.29199,124.48395 427.26001,121.995 428.229,119.50897 428.71301,116.841 428.71301,113.99298 428.71301,111.63898 428.33301,109.513 427.574,107.61298 426.81299,105.71497 425.57001,104.19495 423.84299,103.05597 422.11499,101.91699 420.09201,101.34698 417.77701,101.34698 z M559.97302,86.08197 C565.21301,86.158997 569.182,86.195984 571.87799,86.195984 575.599,86.195984 580.00403,86.158997 585.09198,86.08197 L573.75799,100.81897 C571.09997,104.19397 568.38397,107.836 565.612,111.74298 568.26898,116.64496 574.669,127.47699 584.807,144.23798 580.36499,144.16302 576.35699,144.12396 572.78802,144.12396 569.14203,144.12396 564.96502,144.16302 560.25702,144.23798 L556.72601,137.112 C555.47198,134.64099 554.39001,132.56995 553.47998,130.89795 553.138,130.21399 550.53699,125.55798 545.67499,116.92999 L542.828,111.51398 552.625,97.404968 z M120.19301,85.152954 C112.39,85.152954 103.061,86.341003 92.206999,88.713989 91.791998,91.72998 91.491003,93.944946 91.302999,95.356995 91.113997,96.770996 90.662001,99.343994 89.945997,103.07397 99.477003,99.419983 107.481,97.591003 113.961,97.591003 116.296,97.591003 118.06599,97.979004 119.272,98.75 120.477,99.522949 121.08,100.625 121.08,102.05695 121.08,102.58496 120.985,103.08398 120.797,103.55499 120.608,104.02698 120.296,104.47797 119.864,104.91199 119.432,105.34595 118.866,105.72296 118.169,106.04297 117.472,106.36298 116.30501,106.73999 114.666,107.17297 113.026,107.60699 111.228,108.01196 109.269,108.38898 104.559,109.29297 100.671,110.25397 97.599997,111.27197 94.528997,112.28998 92.108999,113.37396 90.338003,114.52197 88.566999,115.672 87.022001,117.05695 85.704,118.67798 84.386,120.29895 83.415998,121.95599 82.793997,123.65295 82.172003,125.34796 81.861998,127.08295 81.861998,128.854 81.861998,131.75598 82.701002,134.65698 84.377996,137.55896 86.054998,140.46198 88.449003,142.56293 91.557997,143.862 94.667997,145.16302 98.557997,145.81293 103.232,145.81293 106.133,145.81293 109.204,145.54901 112.446,145.02203 113.953,139.44397 115.253,135.203 116.347,132.30096 114.76401,132.82996 113.52099,133.15796 112.616,133.29095 111.712,133.42395 110.864,133.48798 110.073,133.48798 107.848,133.48798 106.228,133.03497 105.211,132.13098 104.194,131.22699 103.685,130.13495 103.685,128.854 103.685,128.02399 103.863,127.26996 104.22,126.59198 104.577,125.91199 105.179,125.25397 106.02501,124.61298 106.871,123.97198 107.867,123.44495 109.014,123.02899 110.16,122.61499 111.75,122.10699 113.77901,121.50397 115.808,120.901 117.22799,120.44995 118.037,120.14697 118.84601,119.84595 119.964,119.35596 121.393,118.67798 120.768,131.64301 120.197,140.19696 119.683,144.34198 123.681,144.26801 127.45199,144.22894 130.996,144.22894 134.65401,144.22894 138.33,144.26801 142.026,144.34198 142.326,132.35699 142.75999,122.672 143.323,115.28497 143.886,107.89795 144.169,103.14996 144.166,101.03796 144.166,96.893005 143.129,93.707947 141.056,91.483948 138.983,89.259949 136.09801,87.648987 132.405,86.651001 128.712,85.652954 124.64,85.152954 120.19301,85.152954 z M180.116,85.151001 C175.10299,85.151001 170.854,85.763977 167.36799,86.987976 163.882,88.212952 161.244,90.181946 159.45399,92.894958 157.66299,95.608948 156.768,98.529968 156.768,101.65796 156.768,103.43097 157.078,105.14496 157.698,106.80298 158.319,108.46198 159.22,110.00696 160.40401,111.43896 161.588,112.87097 163.354,114.51099 165.70399,116.35699 168.05301,118.20496 170.768,120.25696 173.85,122.51898 175.24,123.53595 176.13299,124.33698 176.528,124.92096 176.922,125.505 177.11999,126.09796 177.11999,126.70197 177.11999,127.38 176.85699,128.03998 176.33,128.68097 175.804,129.32196 174.966,129.81195 173.82001,130.14996 172.67399,130.48999 171.179,130.65997 169.337,130.65997 167.11799,130.65997 164.69301,130.31195 162.061,129.61298 159.429,128.91797 156.29001,127.854 152.643,126.41998 L153.095,130.48999 C153.434,133.69299 153.679,136.20898 153.83,138.03699 153.97999,139.86597 154.13099,141.60797 154.282,143.26593 158.653,144.21002 162.488,144.86798 165.78599,145.24493 169.08301,145.62201 171.825,145.81097 174.011,145.81097 177.252,145.81097 180.399,145.51801 183.45199,144.93402 186.504,144.35004 189.33999,143.30499 191.96,141.79694 194.57899,140.289 196.539,138.414 197.839,136.172 199.13901,133.92999 199.789,131.47095 199.789,128.79498 199.789,127.02295 199.49699,125.33795 198.91299,123.73395 198.328,122.133 197.47999,120.625 196.369,119.21295 195.257,117.79895 193.64599,116.26398 191.53599,114.60596 190.254,113.58899 188.483,112.28796 186.222,110.70599 183.96,109.12195 182.537,108.11499 181.953,107.68097 181.36799,107.24896 180.879,106.82397 180.483,106.40997 180.088,105.995 179.81399,105.599 179.664,105.22198 179.51201,104.84497 179.43699,104.45099 179.43699,104.03198 179.43699,102.76996 180.106,101.83197 181.444,101.21899 182.781,100.60797 184.93899,100.30096 187.91701,100.30096 192.13701,100.30096 196.528,101.20496 201.089,103.01398 L200.184,87.185974 C192.044,85.828979 185.354,85.151001 180.116,85.151001 z M490.80099,84.60199 C493.496,84.60199 496.21197,84.744995 498.94598,85.029968 501.67999,85.313965 505.06,85.931946 509.086,86.880981 L509.20001,88.190979 C509.31299,89.557983 509.39898,90.954956 509.45599,92.378967 509.513,93.802979 509.63598,96.052979 509.82599,99.127991 L510.16803,104.19696 C504.737,102.29895 499.935,101.349 495.75702,101.349 492.75699,101.349 490.12701,101.92798 487.86801,103.086 485.608,104.245 483.93799,105.91498 482.85599,108.099 481.77301,110.28296 481.23199,112.81799 481.23199,115.703 481.23199,118.62799 481.716,121.07697 482.68399,123.05096 483.65301,125.02698 485.20001,126.50696 487.32699,127.49396 489.45401,128.48199 491.78799,128.974 494.33301,128.974 495.62399,128.974 497.15301,128.84198 498.919,128.57599 500.685,128.31097 502.22198,128.01599 503.53198,127.69299 504.84002,127.36896 506.5,126.828 508.51398,126.06799 508.323,127.58698 507.86798,130.37799 507.14697,134.44098 L505.66601,143.55402 C499.70398,144.99603 493.87601,145.71796 488.17999,145.71796 484.04001,145.71796 480.41299,145.29999 477.29999,144.46503 473.616,143.47894 470.31399,141.73199 467.39001,139.22498 464.39001,136.64301 462.20599,133.586 460.83899,130.05499 459.20599,125.91595 458.39001,121.28296 458.39001,116.15698 458.39001,111.44897 459.18701,106.91095 460.78299,102.54401 462.37799,98.177979 464.73199,94.578979 467.84601,91.75 470.95901,88.921997 474.41501,87.021973 478.21301,86.054993 482.01001,85.085999 486.20498,84.60199 490.80099,84.60199 z M418.17599,84.600952 C422.88299,84.600952 427.41199,85.322998 431.76001,86.764954 436.108,88.207947 439.781,90.287964 442.781,93.001953 445.781,95.717957 447.99399,98.888977 449.418,102.51495 450.84201,106.14099 451.55401,110.04297 451.55401,114.21997 451.55401,118.28296 450.918,122.14697 449.64599,125.81097 448.37399,129.47595 446.21899,132.91296 443.181,136.12097 440.143,139.33099 436.28,141.73199 431.58999,143.32697 426.89898,144.92194 421.935,145.71893 416.694,145.71893 411.871,145.71893 407.23901,145.01703 402.797,143.612 398.354,142.20795 394.64099,140.15796 391.66,137.461 388.67999,134.76599 386.43899,131.53699 384.93899,127.77795 383.43899,124.01801 382.68899,120.06897 382.68899,115.92999 382.68899,111.79095 383.419,107.841 384.88199,104.08197 386.34299,100.32196 388.65899,96.942993 391.83099,93.942993 395.00101,90.942993 398.922,88.635986 403.59299,87.021973 408.26401,85.407959 413.125,84.600952 418.17599,84.600952 z M240.60699,71.527954 C234.83301,72.92395 231.061,73.789978 229.28799,74.130005 L219.61101,76.108948 C219.27299,81.949951 218.992,85.737976 218.768,87.470947 L209.39999,87.470947 209.231,92.727966 C209.08,96.987976 208.91,100.41699 208.72301,103.01697 L217.531,103.01697 216.295,122.578 C216.069,125.89398 215.938,128.03296 215.901,128.99396 215.864,129.95496 215.845,130.625 215.845,131 215.845,133.11096 216.14599,135.10895 216.74901,136.99396 217.351,138.87897 218.48199,140.54498 220.141,141.99603 221.798,143.44696 223.87199,144.44501 226.35901,144.992 228.84601,145.539 231.69099,145.81195 234.895,145.81195 236.854,145.81195 238.88099,145.69904 240.97201,145.47198 243.06299,145.24493 245.975,144.71796 249.70599,143.88995 L250.949,136.99396 C251.43899,133.979 252.02301,130.88898 252.70199,127.72296 250.21301,128.401 248.479,128.80695 247.49899,128.93799 246.51901,129.07098 245.57501,129.13495 244.67001,129.13495 243.46399,129.13495 242.36001,128.87299 241.36099,128.34399 240.362,127.81598 239.664,126.94897 239.268,125.74396 238.873,124.53699 238.675,123.02899 238.679,121.21899 238.679,120.61798 238.716,119.25995 238.79201,117.14899 L239.47301,103.01599 252.48001,103.01599 C252.48001,100.492 252.629,95.30896 252.931,87.469971 L240.04001,87.469971 C240.15301,81.779968 240.34201,76.466003 240.60699,71.527954 z M12.910002,67.177002 L12.967003,72.151978 C12.966999,75.694946 12.75,82.901001 12.315004,93.774963 11.879999,104.64899 11.445999,113.36298 11.010996,119.91998 10.576,126.479 9.8859997,134.61896 8.9420071,144.34198 L16.969,144.28497 41.842989,144.22797 C52.810003,144.22797 62.890997,144.26703 72.086996,144.341 72.387999,138.388 72.764997,132.62 73.217001,127.04199 69.149,127.30695 66.248999,127.45795 64.516996,127.495 L52.821997,127.77795 C46.796,127.89099 42.822001,127.94598 40.902006,127.94598 L34.404993,127.94598 35.076994,114.20996 C41.517,113.94696 47.337,113.81396 52.535002,113.81396 56.037001,113.81396 61.046003,113.85297 67.563002,113.927 67.900999,107.25696 68.259001,101.51099 68.636,96.685974 59.512999,96.950989 53.896002,97.08197 51.785002,97.08197 45.866999,97.08197 40.684,97.024963 36.234991,96.911987 L36.921995,83.909973 C40.954,83.759949 43.921999,83.675964 45.825987,83.656006 47.728003,83.636963 51.394003,83.626953 56.820997,83.626953 61.758001,83.626953 67.862997,83.778992 75.137007,84.079956 75.136999,82.727966 75.174002,81.393982 75.249998,80.079956 L75.589003,73.936951 C75.738997,71.120972 75.833998,69.485962 75.872,69.036987 L75.987997,67.177002 C67.094999,67.251953 56.828001,67.289001 45.183996,67.289001 32.559999,67.289001 21.802,67.251953 12.910002,67.177002 z M521.15997,66.487 C526.47998,66.562988 530.47302,66.600952 533.13397,66.600952 536.21301,66.600952 539.862,66.562988 544.08203,66.487 543.20202,76.435974 542.40002,88.796997 541.67401,103.56799 540.948,118.33899 540.58398,131.896 540.58398,144.237 536.18402,144.16193 532.46698,144.12299 529.432,144.12299 525.94,144.12396 522.03302,144.16302 517.70898,144.23798 518.23602,139.37799 518.61401,135.42798 518.84002,132.38995 519.143,128.25098 519.44403,123.06897 519.74597,116.83997 L520.367,103.33997 C520.63098,97.22699 520.82001,91.378967 520.93298,85.796997 521.08301,79.113953 521.15997,72.677002 521.15997,66.487 z M263.03699,59.987976 L262.96899,123.05597 290.13199,149.992 0,149.99396 4.8650036,60.034973 z M359.99899,24.969971 L365.922,30.893005 336.89099,59.987976 325.078,59.987976 z M344.255,9.2259521 L350.17801,15.148987 321.40701,43.917969 309.56299,43.919006 z M335.02801,0 L335.14099,0.11199951 291.992,43.258972 331.89099,83.153992 375.03699,40.008972 375.05801,40.028992 375.048,65.002991 355.035,85.036987 375.02301,105.01801 375.01098,150.013 345.005,149.992 345.047,99.97699 300.047,107.02496 300.017,150.04901 270.01599,119.98596 270,9.9859619 z" Fill="Black" Stretch="Fill"/>
而此时的Path就可以直接在Wpf的xaml代码中任意使用了.