缩小时矩形消失

时间:2018-06-19 12:04:10

标签: c# wpf xaml rectangles zooming

我在画布上有允许缩放的元素。但是在某些级别的缩放时,会出现下图所示的问题。没有绘制矩形。当我查看可视的活动树时,检查矩形是否仍然是元素的子级。一切看起来都很正常。当我放大时,如您在第一张图片中看到的,矩形再次出现。

Rectangles are drawn

Disappearing Rectangels

以下是画布中显示的元素:

<Canvas x:Name="katman_1" Width="170.667" Height="46.6667" Canvas.Left="0" Canvas.Top="0">
    <Path Width="57.5973" Height="43.3333" Canvas.Left="88.4704" Canvas.Top="0.996532" Stretch="Fill" Fill="#FF2F71C9" Data="F1 M 146.068,6.91253L 146.068,0.996532L 88.4704,0.996532L 88.4704,44.3299L 146.068,44.3299L 146.068,40.9605C 142.152,39.3965 139.198,32.3739 139.198,23.9365C 139.198,15.5005 142.152,8.47653 146.068,6.91253 Z "/>
    <Path Width="2.367" Height="11.231" Canvas.Left="145.035" Canvas.Top="0.001" Stretch="Fill" Fill="#FF0F4287" Data="F1 M 146.217,9.98227L 146.217,9.98227C 145.565,9.98227 145.035,9.45293 145.035,8.7996L 145.035,0.000930786L 147.401,0.000930786L 147.401,8.7996C 147.401,9.45293 146.871,9.98227 146.217,9.98227 Z "/>
    <Path Width="2.36667" Height="9.98267" Canvas.Left="145.035" Canvas.Top="36.8709" Stretch="Fill" Fill="#FF0F4287" Data="F1 M 146.217,36.8709L 146.217,36.8709C 146.871,36.8709 147.401,37.4003 147.401,38.0536L 147.401,46.8536L 145.035,46.8536L 145.035,38.0536C 145.035,37.4003 145.565,36.8709 146.217,36.8709 Z "/>
    <Path Width="116.785" Height="46.8533" Canvas.Left="30.6155" Canvas.Top="0.000396729" Stretch="Fill" Fill="#FF0F4287" Data="F1 M 43.1915,23.4471C 43.1915,11.9137 47.9608,2.5644 53.8435,2.5644L 53.8435,2.52307L 147.401,2.52307L 147.401,0.000396729L 42.5528,0.000396729L 42.5528,0.0457306C 35.9595,0.0457306 30.6155,10.5244 30.6155,23.4497C 30.6155,36.3751 35.9595,46.8537 42.5528,46.8537L 147.401,46.8537L 147.401,44.3311L 53.8435,44.3311C 47.9608,44.3311 43.1915,34.9804 43.1915,23.4471 Z "/>
    <Path Width="55.5413" Height="41.8067" Canvas.Left="32.9287" Canvas.Top="2.5232" Stretch="Fill" Fill="#FF195099" Data="F1 M 88.47,2.5232L 43.5807,2.5232L 43.5807,2.56453C 37.6967,2.56453 32.9287,11.9139 32.9287,23.4472C 32.9287,34.9805 37.6967,44.3299 43.5807,44.3299L 88.47,44.3299L 88.47,2.5232 Z "/>
    <Path Width="102.914" Height="36.8707" Canvas.Left="36.2841" Canvas.Top="4.99093" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 137.939,40.3696C 137.912,40.4429 137.801,40.6789 137.481,40.6789L 47.3281,40.6789L 46.7148,40.6429C 41.7641,40.6429 37.7255,32.9816 37.5308,23.4269C 37.7255,13.8723 41.7641,6.2096 46.7148,6.2096L 47.3281,6.1736L 137.481,6.1736C 137.801,6.1736 137.912,6.41093 137.939,6.48293C 137.967,6.55627 138.032,6.81227 137.779,7.00693C 133.16,10.5403 130.328,16.3589 130.012,22.7296L 129.956,22.7296C 129.956,22.8043 129.949,22.8776 129.949,22.9523C 129.949,23.1123 129.971,23.2669 129.975,23.4269C 129.971,23.5869 129.949,23.7416 129.949,23.9016C 129.949,23.9763 129.956,24.0483 129.956,24.1229L 130.012,24.1229C 130.328,30.4949 133.16,36.3123 137.779,39.8469C 138.032,40.0416 137.967,40.2963 137.939,40.3696 Z M 131.203,23.4269C 131.336,17.1416 134.045,11.3736 138.544,7.93227C 139.125,7.48693 139.344,6.7656 139.1,6.09227C 138.856,5.42427 138.221,4.99093 137.481,4.99093L 46.7148,4.99093L 46.1001,5.02827L 46.1001,5.05893C 40.8028,5.59626 36.6895,13.0683 36.3201,22.7296L 36.2841,22.7296C 36.2841,22.9656 36.2975,23.1936 36.3015,23.4269C 36.2975,23.6603 36.2841,23.8883 36.2841,24.1229L 36.3201,24.1229C 36.6895,33.7856 40.8028,41.2563 46.1001,41.7936L 46.1001,41.8256L 46.7148,41.8616L 137.481,41.8616C 138.221,41.8616 138.856,41.4296 139.1,40.7603C 139.344,40.0883 139.125,39.3669 138.544,38.9216C 134.045,35.4803 131.336,29.7123 131.203,23.4269 Z "/>
    <Rectangle Width="1.416" Height="3.65067" Canvas.Left="46.44" Canvas.Top="2.52266" Stretch="Fill" Fill="#FFFFFFFF"/>
    <Rectangle Width="1.416" Height="3.64933" Canvas.Left="46.44" Canvas.Top="40.732" Stretch="Fill" Fill="#FFFFFFFF"/>
    <Path Width="7.607" Height="32.9" Canvas.Left="138.461" Canvas.Top="7.55" Stretch="Fill" Fill="#FF0F4287" Data="F1 M 139.859,23.9627C 139.951,12.5507 143.622,10.008 143.659,9.98533L 143.285,9.39466L 142.921,8.8C 142.742,8.908 138.589,11.6093 138.465,23.8533L 138.461,24.004L 138.463,24.004C 138.414,36.2627 142.746,38.9653 142.931,39.0747L 143.649,37.876C 143.61,37.852 139.802,35.3227 139.859,23.9627 Z "/>
    <Path Width="6.59067" Height="6.592" Canvas.Left="164.076" Canvas.Top="20.1309" Stretch="Fill" Fill="#FF0F4287" Data="F1 M 170.667,23.4269C 170.667,25.2469 169.192,26.7229 167.371,26.7229C 165.551,26.7229 164.076,25.2469 164.076,23.4269C 164.076,21.6069 165.551,20.1309 167.371,20.1309C 169.192,20.1309 170.667,21.6069 170.667,23.4269 Z "/>
    <Rectangle Width="28.212" Height="2" SnapsToDevicePixels="True" Canvas.Left="139.198" Canvas.Top="22.536" Stretch="Fill" Fill="#FF0F4287"/>
    <Path Width="6.59067" Height="6.592" Canvas.Left="0" Canvas.Top="20.1309" Stretch="Fill" Fill="#FF0F4287" Data="F1 M 0,23.4269C 0,25.2469 1.47467,26.7229 3.296,26.7229C 5.11467,26.7229 6.59067,25.2469 6.59067,23.4269C 6.59067,21.6069 5.11467,20.1309 3.296,20.1309C 1.47467,20.1309 0,21.6069 0,23.4269 Z "/>
    <Rectangle Width="26.779" SnapsToDevicePixels="True" Height="2" Canvas.Left="4.505" Canvas.Top="22.536" Stretch="Fill" Fill="#FF0F4287"/>
    <Path Width="80.5187" Height="14.4446" Canvas.Left="44.8147" Canvas.Top="16.0552" Stretch="Fill" Fill="#FFFFFFFF" Data="F1 M 118.109,29.1665C 118.057,29.1665 118.007,29.1572 117.956,29.1505C 117.881,29.1399 117.805,29.1319 117.688,29.1252L 56.26,29.1252C 58.0733,27.8105 59.2587,25.6825 59.2587,23.2772C 59.2587,20.8505 58.052,18.7025 56.2093,17.3919L 117.655,17.3825L 118.3,17.4052C 121.496,17.5092 124,20.0879 124,23.2759C 124,26.5252 121.359,29.1665 118.109,29.1665 Z M 46.1813,23.2772C 46.1813,20.0492 48.808,17.4212 52.0373,17.4212C 55.2667,17.4212 57.8933,20.0492 57.8933,23.2772C 57.8933,26.4745 55.3133,29.0759 52.128,29.1252L 51.9467,29.1252C 48.7613,29.0759 46.1813,26.4745 46.1813,23.2772 Z M 118.929,16.1145L 118.257,16.0639C 118.209,16.0559 118.159,16.0505 118.013,16.0612L 51.9227,16.0612L 51.6693,16.0612L 51.6693,16.0745C 47.8587,16.2679 44.8147,19.4199 44.8147,23.2772C 44.8147,27.2599 48.0547,30.4999 52.0373,30.4999C 52.2947,30.4999 52.548,30.4852 52.7987,30.4599L 117.773,30.4719C 117.884,30.4865 117.995,30.4999 118.109,30.4999C 122.092,30.4999 125.333,27.2585 125.333,23.2759C 125.333,19.5612 122.565,16.5225 118.929,16.1145 Z "/>
</Canvas>

谢谢!

0 个答案:

没有答案