程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> 關於.NET >> 在WPF中自定義你的繪制(四)---part3

在WPF中自定義你的繪制(四)---part3

編輯:關於.NET

<Viewbox x:Name="Group_46" Width="33.5947" Height="48.518" Canvas.Left="372.866" Canvas.Top="366.017">
<Canvas Width="33.5947" Height="48.518">
<Viewbox x:Name="Group_47" Width="26.4369" Height="48.518" Canvas.Left="0" Canvas.Top="0">
<Canvas Width="26.4369" Height="48.518">
<Path x:Name="Path_48" Width="24.7215" Height="24.1663" Canvas.Left="0.378533" Canvas.Top="24.3516" Stretch="Fill" StrokeThickness="1.34774" StrokeLineJoin="Round" Stroke="#FF000000" Data="F1 M 12.7452,25.0255C 19.1965,25.0255 24.4262,30.1336 24.4262,36.4348C 24.4262,42.736 19.1964,47.8441 12.7452,47.8441C 6.29407,47.8441 0.761139,45.4245 1.0643,39.1302C 1.52682,29.528 6.29404,25.0255 12.7452,25.0255 Z ">
<Path.Fill>
<LinearGradientBrush StartPoint="0.484648,0.0961876" EndPoint="1.33083,0.0961876">
<LinearGradientBrush.RelativeTransform>
<TransformGroup>
<SkewTransform CenterX="0.484648" CenterY="0.0961876" AngleX="0.0564695" AngleY="0"/>
<RotateTransform CenterX="0.484648" CenterY="0.0961876" Angle="88.7828"/>
</TransformGroup>
</LinearGradientBrush.RelativeTransform>
<LinearGradientBrush.GradientStops>
<GradientStop Color="#FE232531" Offset="0"/>
<GradientStop Color="#FE7976BC" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Path.Fill>
</Path>
<Path x:Name="Path_49" Width="16" Height="15.4446" Canvas.Left="4.34692" Canvas.Top="28.5982" Stretch="Fill" Fill="#FF000000" Data="F1 M 12.3469,28.5982C 16.7653,28.5982 20.3469,32.0555 20.3469,36.3206C 20.3469,40.5855 16.7652,44.0428 12.3469,44.0428C 7.92859,44.0428 4.34692,40.5855 4.34692,36.3206C 4.34692,32.0555 7.9285,28.5982 12.3469,28.5982 Z "/>
<Path x:Name="Path_50" Width="5.73459" Height="5.73459" Canvas.Left="4.04288" Canvas.Top="29.1003" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 6.91019,29.1003C 8.49377,29.1003 9.77747,30.3839 9.77747,31.9675C 9.77747,33.5511 8.49377,34.8348 6.91019,34.8348C 5.32663,34.8348 4.04288,33.5511 4.04288,31.9675C 4.04288,30.3839 5.32657,29.1003 6.91019,29.1003 Z "/>
<Path x:Name="Path_51" Width="25.7077" Height="9.70916" Canvas.Left="0" Canvas.Top="2.04048" Stretch="Fill" Fill="#FF6E4A29" Data="F1 M 25.6552,11.7316C 26.4369,12.0475 18.3257,8.1297 13.0832,7.02795C 7.25159,5.80231 0,7.15393 0,7.15393C 0,7.15393 4.26468,0 15.3411,2.61563C 18.5676,3.37756 22.4447,6.67969 25.6552,11.7316 Z "/>
</Canvas>
</Viewbox>
<Path x:Name="Path_52" Width="27.3284" Height="10.9924" Canvas.Left="4.41272" Canvas.Top="17.6978" Stretch="Fill" Fill="#FF000000" Data="F1 M 11.8783,24.5301C 11.9547,24.1081 30.2786,26.4581 29.1555,17.6978C 31.1771,18.8957 33.5947,27.4541 29.5514,27.4541C 26.5515,28.0096 8.70422,24.093 4.41272,28.6902C 6.99588,26.093 9.87094,25.2319 11.8783,24.5301 Z "/>
</Canvas>
</Viewbox>
<Viewbox x:Name="Group_53" Width="89.2222" Height="67.8574" Canvas.Left="289.17" Canvas.Top="273.53">
<Canvas Width="89.2222" Height="67.8574">
<Path x:Name="Path_54" Width="53.2217" Height="57.2385" Canvas.Left="0.282065" Canvas.Top="7.41022" Stretch="Fill" StrokeThickness="0.0864429" StrokeLineJoin="Round" Stroke="#D2FBFFB1" Fill="#D2FBFFB1" Data="F1 M 0.34613,63.9778C 0.396057,64.1629 0.383728,64.3776 0.495911,64.533C 0.552124,64.6108 0.69635,64.6257 0.780304,64.5791C 1.43472,64.2156 1.66672,63.3626 1.99316,62.689C 9.99384,48.3768 20.0854,34.7239 32.7285,24.2835C 36.903,20.8364 41.3491,17.6966 45.9843,14.8994C 47.7488,13.8346 49.5555,12.8323 51.249,11.6577C 52.2035,10.9957 53.7285,10.0517 53.42,8.93188C 53.0832,7.70947 51.1781,7.51685 49.9113,7.46265C 47.652,7.36597 45.4077,8.04865 43.239,8.68927C 37.4034,10.413 32.2019,14.0585 27.4668,17.88C 18.9402,24.7616 12.2059,34.0191 7.22125,43.7768C 4.22864,49.6348 1.02649,55.737 0.364014,62.2817L 0.325287,63.2106L 0.34613,63.9778 Z "/>
</Canvas>
</Viewbox>
<Viewbox x:Name="Group_55" Width="86.2222" Height="66.348" Canvas.Left="274.948" Canvas.Top="273.595">
<Canvas Width="86.2222" Height="66.348">
<Path x:Name="Path_56" Width="50.1118" Height="55.4352" Canvas.Left="0.47025" Canvas.Top="7.62567" Stretch="Fill" StrokeThickness="0.0653593" StrokeLineJoin="Round" Stroke="#ABFBFFAF" Fill="#ABFBFFAF" Data="F1 M 0.50293,62.4499C 0.532135,62.6239 0.505493,62.8174 0.590576,62.972C 0.625671,63.0357 0.747986,63.0447 0.806824,63.0019C 1.37988,62.5849 1.55145,61.7901 1.83221,61.1394C 8.87073,47.0291 17.6928,33.091 29.7973,22.9854C 33.8643,19.59 38.2202,16.4983 42.831,13.8887C 44.6017,12.8865 46.4208,11.969 48.1665,10.9238C 49.1061,10.3613 50.8085,9.6828 50.5161,8.62744C 50.2034,7.4989 48.304,7.65466 47.1332,7.67932C 45.0433,7.72339 42.9995,8.39844 41.0144,9.05359C 35.3827,10.912 30.3428,14.442 25.7519,18.1961C 18.528,24.1033 12.9691,32.0357 8.43213,40.1901C 4.85413,46.6208 1.63507,53.5455 0.600433,60.8315L 0.52478,61.7193L 0.50293,62.4499 Z "/>
</Canvas>
</Viewbox>
<Viewbox x:Name="Group_57" Width="86.2222" Height="65.9662" Canvas.Left="258.726" Canvas.Top="275.422">
<Canvas Width="86.2222" Height="65.9662">
<Path x:Name="Path_58" Width="49.9857" Height="54.964" Canvas.Left="0.611926" Canvas.Top="7.70598" Stretch="Fill" StrokeThickness="0.0451885" StrokeLineJoin="Round" Stroke="#68FAFF9A" Fill="#68FAFF9A" Data="F1 M 0.639923,62.1024C 0.64801,62.2711 0.610199,62.4485 0.664246,62.6086C 0.68042,62.6566 0.780273,62.6587 0.815491,62.6223C 1.30008,62.122 1.43439,61.3716 1.67828,60.7191C 8.00842,46.1842 17.0639,32.096 29.2716,21.9814C 33.3998,18.561 37.8334,15.4458 42.573,12.9405C 44.3799,11.9854 46.2325,11.119 48.0569,10.1979C 48.9771,9.73328 50.828,9.35449 50.5462,8.36292C 50.2519,7.32739 48.4135,7.84552 47.3425,7.95465C 45.305,8.16229 43.3371,8.86072 41.4109,9.55652C 35.9254,11.538 30.9937,14.9829 26.4747,18.6701C 19.3251,24.5037 13.7461,32.253 9.11987,40.2372C 5.46002,46.5535 2.18512,53.3337 0.82663,60.5063L 0.708466,61.3835L 0.639923,62.1024 Z "/>
</Canvas>
</Viewbox>
<Viewbox x:Name="Group_59" Width="86.2222" Height="66.4278" Canvas.Left="304.726" Canvas.Top="276.96">
<Canvas Width="86.2222" Height="66.4278">
<Path x:Name="Path_60" Width="50.1397" Height="55.5588" Canvas.Left="0.439516" Canvas.Top="7.58351" Stretch="Fill" StrokeThickness="0.0695761" StrokeLineJoin="Round" Stroke="#ABFBFFA8" Fill="#ABFBFFA8" Data="F1 M 0.474304,62.5225C 0.507935,62.6977 0.484375,62.8944 0.575226,63.0479C 0.614655,63.1145 0.741089,63.1248 0.805054,63.0812C 1.39328,62.6805 1.57574,61.8778 1.86444,61.2272C 9.04791,47.2098 17.8241,33.2993 29.9072,23.1953C 33.9615,19.805 38.3013,16.718 42.8849,14.0869C 44.6483,13.0747 46.4608,12.1458 48.1895,11.0756C 49.1341,10.4907 50.8055,9.75366 50.5098,8.68274C 50.1921,7.5321 48.2832,7.61591 47.0895,7.62177C 44.9898,7.63208 42.9293,8.30176 40.9316,8.94843C 35.2699,10.7813 30.2068,14.3288 25.6008,18.097C 18.3614,24.0197 12.8065,31.9903 8.28836,40.1802C 4.72736,46.6352 1.52036,53.5912 0.553162,60.8994L 0.486389,61.7895L 0.474304,62.5225 Z "/>
</Canvas>
</Viewbox>
<Viewbox x:Name="Group_61" Width="86.2222" Height="65.9663" Canvas.Left="319.392" Canvas.Top="281.199">
<Canvas Width="86.2222" Height="65.9663">
<Path x:Name="Path_62" Width="49.9857" Height="54.964" Canvas.Left="0.61192" Canvas.Top="7.70599" Stretch="Fill" StrokeThickness="0.0451885" StrokeLineJoin="Round" Stroke="#6AFAFF9A" Fill="#6AFAFF9A" Data="F1 M 0.639923,62.1024C 0.64801,62.2711 0.610199,62.4486 0.664215,62.6086C 0.68042,62.6566 0.780243,62.6587 0.81546,62.6223C 1.30008,62.122 1.43436,61.3716 1.67825,60.7191C 8.00839,46.1842 17.0639,32.096 29.2716,21.9814C 33.3997,18.561 37.8334,15.4458 42.573,12.9406C 44.3799,11.9854 46.2325,11.119 48.0569,10.1979C 48.9771,9.73328 50.8279,9.35449 50.5462,8.36292C 50.2519,7.32739 48.4135,7.84555 47.3425,7.95468C 45.305,8.16232 43.3371,8.86072 41.4109,9.55652C 35.9254,11.538 30.9936,14.9829 26.4747,18.6701C 19.3251,24.5037 13.7461,32.2531 9.11984,40.2372C 5.45999,46.5535 2.18512,53.3337 0.82663,60.5063L 0.708466,61.3835L 0.639923,62.1024 Z "/>
</Canvas>
</Viewbox>
<Path x:Name="Path_63" Width="206.667" Height="94.9438" Canvas.Left="229.057" Canvas.Top="284.251" Stretch="Fill" StrokeThickness="3" StrokeLineJoin="Round" Stroke="#67000000" Fill="#FFDFDFDF" Data="F1 M 434.224,377.694C 419.177,256.367 246.288,254.145 230.557,376.806C 255.621,279.034 399.621,266.589 434.224,377.694 Z "/>
<Viewbox x:Name="Group_64" Width="62.5641" Height="99.8643" Canvas.Left="362.66" Canvas.Top="227.873">
<Canvas Width="62.5641" Height="99.8643">
<Path x:Name="Path_65" Width="41.7173" Height="71.6743" Canvas.Left="8.11356" Canvas.Top="17.4249" Stretch="Fill" StrokeThickness="3" StrokeLineJoin="Round" Stroke="#FF313131" Fill="#FFFFFFFF" Data="F1 M 10.6196,69.2201C 10.6196,69.2201 1.5,1.5 38.1752,23.2202C 61.0641,36.7756 38.5276,76.8341 35.5722,87.5992"/>
<Path x:Name="Path_66" Width="30.0553" Height="62.4436" Canvas.Left="13.0386" Canvas.Top="24.0987" Stretch="Fill" StrokeThickness="3" StrokeLineJoin="Round" Stroke="#FFB03500" Data="F1 M 14.6196,72.2645C 14.6196,72.2645 12.3974,19.6646 31.2307,26.1532C 53.2314,33.7332 33.6619,78.154 31.7307,85.0423">
<Path.Fill>
<RadialGradientBrush RadiusX="0.840576" RadiusY="1.52673" Center="0.35972,0.849758" GradientOrigin="0.35972,0.849758">
<RadialGradientBrush.GradientStops>
<GradientStop Color="#FEE4E4E4" Offset="0.035865"/>
<GradientStop Color="#FEFF5D04" Offset="1"/>
</RadialGradientBrush.GradientStops>
<RadialGradientBrush.RelativeTransform>
<TransformGroup>
<SkewTransform CenterX="0.35972" CenterY="0.849758" AngleX="18.0147" AngleY="0"/>
<RotateTransform CenterX="0.35972" CenterY="0.849758" Angle="-66.1328"/>
</TransformGroup>
</RadialGradientBrush.RelativeTransform>
</RadialGradientBrush>
</Path.Fill>
</Path>
</Canvas>
</Viewbox>
<Viewbox x:Name="Group_67" Width="62.5641" Height="99.8643" Canvas.Left="238.909" Canvas.Top="227.873">
<Canvas Width="62.5641" Height="99.8643">
<Path x:Name="Path_68" Width="41.7173" Height="71.6743" Canvas.Left="12.7332" Canvas.Top="17.4249" Stretch="Fill" StrokeThickness="3" StrokeLineJoin="Round" Stroke="#FF313131" Fill="#FFFFFFFF" Data="F1 M 51.9445,69.2201C 51.9445,69.2201 61.0641,1.5 24.3889,23.2202C 1.5,36.7756 24.0365,76.8341 26.9919,87.5992"/>
<Path x:Name="Path_69" Width="30.0553" Height="62.4436" Canvas.Left="19.4702" Canvas.Top="24.0987" Stretch="Fill" StrokeThickness="3" StrokeLineJoin="Round" Stroke="#FFB03500" Data="F1 M 47.9445,72.2645C 47.9445,72.2645 50.1666,19.6646 31.3334,26.1532C 9.33263,33.7332 28.9021,78.154 30.8333,85.0423">
<Path.Fill>
<RadialGradientBrush RadiusX="0.840576" RadiusY="1.52673" Center="0.64028,0.849758" GradientOrigin="0.64028,0.849758">
<RadialGradientBrush.GradientStops>
<GradientStop Color="#FEE4E4E4" Offset="0.035865"/>
<GradientStop Color="#FEFF5D04" Offset="1"/>
</RadialGradientBrush.GradientStops>
<RadialGradientBrush.RelativeTransform>
<TransformGroup>
<SkewTransform CenterX="0.64028" CenterY="0.849758" AngleX="-18.0147" AngleY="0"/>
<RotateTransform CenterX="0.64028" CenterY="0.849758" Angle="246.133"/>
</TransformGroup>
</RadialGradientBrush.RelativeTransform>
</RadialGradientBrush>
</Path.Fill>
</Path>
</Canvas>
</Viewbox>
<Path x:Name="Path_70" Width="141.333" Height="30.69" Canvas.Left="260.002" Canvas.Top="292.181" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 260.002,322.204C 260.185,322.664 292.335,291.204 328.669,292.204C 365.002,293.204 383.169,304.038 401.335,322.871C 379.335,304.538 360.835,295.638 328.002,295.638C 300.669,295.638 274.002,311.538 260.002,322.204 Z "/>
</Canvas>
<Canvas x:Name="Helmet" d:IsLayer="True" Width="800" Height="800" Canvas.Left="0" Canvas.Top="0">
<Ellipse x:Name="Ellipse_71" Width="252" Height="252" Canvas.Left="204" Canvas.Top="222" Stretch="Fill" StrokeThickness="8" StrokeLineJoin="Round" Stroke="#5FFFFFFF">
<Ellipse.Fill>
<RadialGradientBrush RadiusX="0.63492" RadiusY="0.634921" Center="0.477954,0.779541" GradientOrigin="0.477954,0.779541">
<RadialGradientBrush.GradientStops>
<GradientStop Color="#00FFFFFF" Offset="0"/>
<GradientStop Color="#34FFFFFF" Offset="1"/>
</RadialGradientBrush.GradientStops>
<RadialGradientBrush.RelativeTransform>
<TransformGroup>
<RotateTransform CenterX="0.477954" CenterY="0.779541" Angle="-90"/>
</TransformGroup>
</RadialGradientBrush.RelativeTransform>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Path x:Name="Path_72" Width="182.649" Height="44.8834" Canvas.Left="238.898" Canvas.Top="235.638" Stretch="Fill" Data="F1 M 327.775,235.638C 350.387,235.638 395.194,242.694 421.547,280.521C 409.625,269.937 373.653,255.985 329.03,255.985C 284.408,255.985 248.926,271.309 238.898,279.737C 258.965,250.337 301.21,235.638 327.775,235.638 Z ">
<Path.Fill>
<RadialGradientBrush RadiusX="0.531" RadiusY="1.39377" Center="0.502061,1.47467" GradientOrigin="0.502061,1.47467">
<RadialGradientBrush.GradientStops>
<GradientStop Color="#00FFFFFF" Offset="0.800847"/>
<GradientStop Color="#9DFFFFFF" Offset="1"/>
</RadialGradientBrush.GradientStops>
<RadialGradientBrush.RelativeTransform>
<TransformGroup>
<SkewTransform CenterX="0.502061" CenterY="1.47467" AngleX="-0.0142521" AngleY="0"/>
</TransformGroup>
</RadialGradientBrush.RelativeTransform>
</RadialGradientBrush>
</Path.Fill>
</Path>
</Canvas>
</Canvas>
</Page>
你會發現上面的代碼中,有許多這樣的片段:

Data="F1 M 10.1172,19.4509L 1.5,21.2192L 1.5,40.5689L 10.231,42.0653L 10.1172,19.4509 Z "

這其實是描述PathGeometry所包含的數據的更輕量級的表示形式

你可以在MSDN的path markup syntax節找到解釋

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved