Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/304.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WPF路径几何体意外标记_C#_Wpf - Fatal编程技术网

C# WPF路径几何体意外标记

C# WPF路径几何体意外标记,c#,wpf,C#,Wpf,我试图用一个路径来画一个形状,我从一个SVG文件中得到。我认为我做的每件事都是对的,但是我不断地得到这个错误,我不知道为什么。我正从SVG文件复制数据行。 这是我的密码: PathGeometry pathGeometry = new PathGeometry(); TransformGroup transformGroup = new TransformGroup(); transformGroup.Children.Add(new TranslateTransfor

我试图用一个路径来画一个形状,我从一个SVG文件中得到。我认为我做的每件事都是对的,但是我不断地得到这个错误,我不知道为什么。我正从SVG文件复制数据行。 这是我的密码:

     PathGeometry pathGeometry = new PathGeometry();
    TransformGroup transformGroup = new TransformGroup();
    transformGroup.Children.Add(new TranslateTransform(0.000000, 1348.000000));
    transformGroup.Children.Add(new ScaleTransform(0.100000, -0.100000));
    pathGeometry.Transform =  transformGroup;
    pathGeometry.AddGeometry(Geometry.Parse(PainSigilDatas(1)));
    pathGeometry.AddGeometry( Geometry.Parse(PainSigilDatas(2)));
    pathGeometry.AddGeometry(Geometry.Parse(PainSigilDatas(3)));
    pathGeometry.AddGeometry(Geometry.Parse(PainSigilDatas(4)));
    pathGeometry.AddGeometry(Geometry.Parse(PainSigilDatas(5)));
    pathGeometry.AddGeometry(Geometry.Parse(PainSigilDatas(6)));
    pathGeometry.AddGeometry(Geometry.Parse(PainSigilDatas(7)));
    pathGeometry.AddGeometry(Geometry.Parse(PainSigilDatas(8)));
    
    return pathGeometry;

 string PainSigilDatas( int dataPath)
 {
    string data = string.Empty;
    switch (dataPath)
    {
            case 1:
                data = "M5322 12254 c-17 -7 -38 -23 -47 -37 -22 -34 -49 -135 -65 -237 -6"
                       + "-47 -18 -101 -26 -120 -8 -19 -18 -93 -23 -165 -13 -173 -45 -367 -81 -490"
                       + "-16 -55 -39 -140 -51 -190 -11 -49 -29 -103 -39 -120 -11 -16 -54 -59 -97 -95"
                       + "-108 -90 -237 -219 -256 -257 -22 -41 -9 -150 25 -219 88 -177 114 -221 159"
                       + "-277 28 -34 64 -89 81 -122 17 -33 40 -78 51 -99 14 -27 22 -64 24 -120 4 -86"
                       + "24 -142 53 -151 10 -3 49 -1 86 5 187 31 324 31 409 1 77 -27 134 -27 163 -1"
                       + "26 24 30 42 35 135 2 39 9 88 15 110 8 29 8 92 1 225 -17 294 -36 521 -48 569"
                       + "-9 33 -9 52 0 79 8 24 10 69 5 136 -3 56 -9 182 -11 281 -7 250 -5 234 -71"
                       + "522 -8 34 -14 84 -14 110 0 49 -61 250 -107 353 -33 74 -103 178 -124 183 -9"
                       + "2 -30 -1 -47 -9z";
                break;
            case 2:
                data = "M6114 10490 c-27 -11 -54 -48 -54 -75 0 -11 7 -38 15 -60 28 -78 16"
                       + "-409 -20 -555 -7 -30 -19 -99 -26 -152 l-12 -97 26 -40 c35 -52 83 -88 144"
                       + "-106 66 -20 127 -62 218 -151 43 -41 86 -75 98 -76 43 -3 72 4 91 20 43 39 44"
                       + "51 35 367 -8 289 -15 364 -45 450 -7 22 -16 60 -20 85 -4 25 -15 61 -24 80"
                       + "-20 40 -102 120 -146 143 -16 9 -51 38 -79 66 -27 28 -53 51 -58 51 -4 0 -23"
                       + "11 -40 24 -38 29 -74 38 -103 26z";
                break;

            case 3:
                data = "M4022 10299 c-54 -27 -101 -89 -143 -187 l-33 -77 -1 -185 c-1 -171"
                       + "1 -190 22 -249 13 -35 30 -73 38 -85 8 -11 15 -32 15 -46 0 -30 42 -162 64"
                       + "-205 9 -16 16 -43 16 -58 0 -42 25 -94 49 -102 17 -5 39 10 114 80 50 48 106"
                       + "94 122 102 17 8 37 21 45 28 8 7 33 18 55 24 68 19 149 65 162 91 18 35 16"
                       + "131 -3 187 -17 49 -46 94 -101 153 -18 19 -35 43 -38 52 -3 9 -28 33 -55 52"
                       + "-28 20 -50 42 -50 50 0 7 -9 25 -20 39 -11 14 -27 44 -35 66 -8 22 -25 57 -39"
                       + "78 -19 27 -26 51 -26 85 0 63 -13 94 -49 113 -40 20 -58 19 -109 -6z";

                break;

            case 4:
                data = "M3419 9385 c-14 -7 -30 -25 -37 -39 -6 -14 -16 -140 -22 -297 -10"
                       + "-247 -10 -276 5 -316 24 -63 72 -80 134 -49 27 14 155 172 196 242 l20 34 -37"
                       + "30 c-48 39 -100 139 -128 243 -12 45 -31 93 -41 106 -11 13 -19 32 -19 42 0"
                       + "23 -33 25 -71 4z";
                break;

            case 5:
                data = "M6846 9318 c-3 -13 -10 -58 -17 -101 -11 -65 -19 -85 -50 -122 -29"
                       + "-36 -39 -58 -44 -100 -4 -30 -4 -67 0 -82 8 -32 63 -145 74 -153 4 -3 31 -40"
                       + "60 -82 28 -43 58 -78 66 -78 8 0 30 14 49 31 41 36 66 97 91 224 17 85 17 93"
                       + "1 150 -22 78 -31 114 -51 207 -22 102 -47 128 -121 128 -48 0 -54 -3 -58 -22z";
                break;
               case 6:
                 data = "M5205 9279 c-22 -4 -61 -8 -87 -8 -26 -1 -98 -10 -160 -20 -110 -19"
                 + "-218 -61 -358 -140 -19 -11 -98 -51 -175 -89 -77 -38 -214 -118 -305 -178"
                 + "-179 -117 -272 -202 -459 -418 -58 -66 -108 -115 -130 -125 -120 -55 -363"
                 + "-246 -436 -343 -10 -15 -45 -39 -77 -54 -32 -15 -58 -31 -58 -34 0 -19 -81"
                 + "-39 -450 -110 -113 -22 -245 -53 -294 -70 -49 -16 -104 -30 -121 -30 -35 0"
                 + "-153 -40 -188 -63 -12 -8 -55 -69 -95 -136 -79 -131 -91 -172 -92 -311 0 -118"
                 + "8 -140 54 -161 47 -21 145 -25 179 -8 12 7 56 46 97 88 41 42 86 82 100 88"
                 + "170 75 319 113 470 118 60 2 128 9 152 16 91 24 157 28 201 13 23 -8 74 -15"
                 + "112 -15 39 0 90 -6 115 -13 234 -72 403 -132 443 -157 27 -16 74 -39 105 -51"
                 + "32 -11 68 -31 82 -43 14 -13 39 -31 56 -41 39 -24 125 -96 188 -157 67 -66 75"
                 + "-70 217 -123 179 -66 260 -77 483 -65 107 6 197 7 217 2 19 -5 60 -12 91 -16"
                 + "55 -6 58 -5 69 19 10 20 9 34 -4 68 -9 24 -21 61 -26 83 -13 50 -56 79 -155"
                 + "107 -39 11 -91 30 -116 43 -25 12 -71 33 -103 45 -31 12 -74 36 -95 52 -20 17"
                 + "-50 37 -67 45 -28 15 -95 74 -172 151 -19 19 -54 75 -78 126 -41 84 -45 99"
                 + "-46 171 -1 44 -4 123 -8 175 -9 130 -1 157 92 335 26 50 98 117 195 178 23 15"
                 + "42 32 42 37 0 15 94 59 163 76 34 9 79 27 101 41 21 14 76 34 123 46 l84 20"
                 + "35 -36 c20 -20 44 -39 55 -42 16 -5 19 -16 19 -68 -1 -93 -32 -122 -212 -191"
                 + "-115 -45 -176 -82 -212 -128 -34 -46 -93 -173 -106 -234 -14 -63 2 -165 42"
                 + "-259 58 -138 71 -155 143 -195 22 -12 69 -40 105 -61 36 -21 112 -54 170 -75"
                 + "96 -33 115 -36 225 -37 108 -2 124 0 165 22 73 38 230 162 260 207 8 12 40 49"
                 + "72 83 67 74 86 111 100 197 8 56 7 72 -13 132 -38 116 -120 273 -162 312 -22"
                 + "19 -57 52 -79 72 -22 20 -62 44 -88 53 -27 9 -60 27 -73 41 -47 46 -45 176 3"
                 + "219 11 10 20 26 20 37 0 24 19 23 102 -7 38 -14 77 -25 87 -25 10 0 45 -17 77"
                 + "-38 33 -21 82 -47 109 -57 69 -26 147 -85 166 -126 9 -19 29 -60 43 -93 15"
                 + "-32 44 -80 65 -105 71 -86 109 -161 122 -238 11 -69 10 -77 -19 -180 -18 -59"
                 + "-36 -138 -41 -175 -9 -66 -53 -157 -102 -213 -9 -11 -33 -47 -53 -81 -21 -36"                    
                 + "-52 -72 -76 -89 -23 -16 -47 -36 -53 -45 -34 -46 -191 -124 -343 -171 -41 -12"
                 + "-55 -30 -64 -82 -12 -62 2 -80 53 -73 23 3 87 8 142 11 55 2 123 7 150 10 64"
                 + "7 195 45 195 56 0 5 12 9 28 9 15 1 52 10 82 21 30 11 73 25 95 31 22 7 76 33" 
                 + "120 59 44 26 114 66 155 88 59 32 85 55 120 102 68 91 105 128 144 144 32 14"
                 + "40 14 74 -1 24 -10 86 -19 173 -24 123 -7 141 -10 199 -39 36 -17 73 -31 83"
                 + "-31 32 0 95 -39 118 -72 59 -87 100 -109 163 -88 48 16 66 58 66 157 0 92 -3"
                 + "97 -104 200 -159 161 -215 220 -241 258 -56 79 -244 248 -352 317 -35 22 -63"
                 + "43 -63 48 0 4 -22 31 -49 60 -27 29 -63 80 -79 114 -42 86 -72 154 -72 162 0"
                 + "4 -8 26 -18 48 -11 23 -31 72 -46 111 -16 40 -45 88 -67 112 -21 23 -39 48"
                 + "-39 55 0 18 -188 196 -230 218 -19 10 -62 46 -95 81 -127 131 -152 155 -194"
                 + "189 -25 19 -50 41 -57 48 -22 21 -117 62 -146 62 -15 0 -49 8 -75 19 -26 10"
                 + "-84 21 -128 25 -44 4 -120 14 -170 21 -97 16 -235 18 -300 4z";

                break;
            case 7:

                data = "M6115 6454 c-46 -24 -132 -35 -180 -23 -35 9 -48 8 -73 -5 -21 -11"
                       + "-55 -16 -104 -15 -41 1 -95 -6 -123 -15 -27 -8 -69 -20 -92 -26 -33 -8 -43"
                       + "-16 -43 -31 0 -11 -11 -64 -25 -119 -29 -118 -30 -136 -20 -356 8 -183 -3"
                       + "-269 -46 -355 -28 -56 -48 -198 -55 -389 -5 -117 -13 -199 -25 -248 -23 -90"
                       + "-93 -249 -149 -334 -22 -34 -55 -98 -72 -143 l-33 -80 -1 -270 c0 -148 -6"
                       + "-310 -12 -360 -6 -49 -16 -157 -22 -240 -11 -153 -53 -423 -70 -453 -12 -20"
                       + "-66 -234 -86 -342 -8 -41 -22 -98 -31 -127 -14 -45 -14 -67 -3 -184 7 -74 18"
                       + "-150 25 -169 8 -19 21 -71 31 -115 26 -122 89 -306 129 -373 19 -33 35 -64 35"
                       + "-69 0 -4 16 -25 35 -45 60 -63 161 -74 244 -28 46 27 85 85 159 235 118 239"
                       + "150 318 166 405 8 47 24 128 36 180 20 94 29 298 13 323 -3 6 -9 83 -13 171"
                       + "-4 95 -12 170 -19 184 -25 46 -43 189 -46 369 -2 100 -6 186 -9 191 -3 5 -8"
                       + "74 -11 155 -5 156 -25 263 -56 314 -37 59 -48 121 -44 248 3 140 30 343 51"
                       + "394 32 76 66 238 69 333 4 94 32 254 54 310 5 15 12 115 15 223 3 108 10 220"
                       + "17 249 11 49 16 56 65 86 29 17 60 44 70 58 21 34 87 94 140 129 22 14 54 47"
                       + "70 72 15 25 47 71 69 101 22 31 51 80 65 109 l24 53 -23 19 c-28 23 -56 24"
                       + "-96 3z";
                break;
            case 8:
                data = "M4420 6418 c-25 -13 -46 -31 -48 -41 -6 -28 56 -175 94 -228 39 -53"
                       + "108 -119 126 -119 31 0 59 -49 94 -159 21 -64 48 -133 61 -153 12 -21 23 -50"
                       + "23 -65 1 -35 24 -99 43 -121 8 -9 20 -36 26 -58 15 -56 46 -125 70 -155 22"
                       + "-28 28 -75 37 -279 6 -141 14 -176 39 -166 7 2 18 -1 24 -7 17 -17 31 3 52 75"
                       + "10 34 25 83 32 108 28 86 37 141 37 213 0 40 5 88 10 107 6 19 15 77 21 128 5"
                       + "51 14 105 20 120 14 37 39 170 39 209 0 18 -24 107 -54 198 -32 96 -54 183"
                       + "-54 207 1 60 -35 90 -142 118 -47 13 -114 26 -150 30 -36 4 -94 17 -130 29"
                       + "-36 12 -101 24 -145 26 -69 5 -86 2 -125 -17z";
                break;
           
        }

    return data;
}
同样的数据路径信息在我的XML代码中也能很好地工作。所以它应该在这里工作,对吗?我希望能够随机改变出不同颜色的不同符号。这就是为什么我没有为此使用工作xml代码的原因

我试着把所有的小写字母大写,但没用。它也不会告诉我
意外的标记是。

是的,很不幸,您不能将svg插入xaml。几何体格式之间没有细微差别,我不记得具体的细节……但是,有兼容的代码可供使用,但需要进行转换。此外,您没有在行尾添加空格。例如:
“…-86”+“24-142…”
将产生
“…-8624-142…”