翼度科技»论坛 编程开发 .net 查看内容

WPF绘图指南:用XAML轻松实现圆、线、矩形、文字、图片创意元素

10

主题

10

帖子

30

积分

新手上路

Rank: 1

积分
30
 
概述:在WPF中,通过使用不同的元素如Ellipse、Line、Rectangle等,可以轻松绘制各种图形,包括圆、线条、椭圆、矩形、多边形等。同时,通过TextBlock展示文字,Image展示图片,以及Path创建路径和曲线,使得图形的绘制变得灵活多样。通过简单的XAML代码,开发者可以快速构建各种图形和界面元素
在WPF中,你可以使用Ellipse、Line、Rectangle、Polygon等元素来绘制基本的形状,同时可以使用TextBlock来显示文字,Image来展示图片,以及Path元素来创建复杂的路径和曲线。以下是详细的步骤和示例源代码:
看一个综合应用效果:

 
源代码文末提供
下面来看下基础绘制方法:
1. 画圆
  1. <Canvas>
  2. <Canvas>
  3. <Canvas>
  4. <Canvas>
  5. <Canvas>
  6. <Canvas>
  7. <Canvas>
  8.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  9. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  10. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  11. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  12. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  13. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  14. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  15. </Canvas>
复制代码
2. 画线条
  1. <Canvas>
  2. <Canvas>
  3. <Canvas>
  4. <Canvas>
  5. <Canvas>
  6. <Canvas>
  7. <Canvas>
  8.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  9. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  10. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  11. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  12. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  13. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  14. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  15. </Canvas>
复制代码
3. 画椭圆
  1. <Canvas>
  2. <Canvas>
  3. <Canvas>
  4. <Canvas>
  5. <Canvas>
  6. <Canvas>
  7. <Canvas>
  8.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  9. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  10. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  11. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  12. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  13. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  14. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  15. </Canvas>
复制代码
4. 画矩形
  1. <Canvas>
  2. <Canvas>
  3. <Canvas>
  4. <Canvas>
  5. <Canvas>
  6. <Canvas>
  7. <Canvas>
  8.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  9. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  10. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  11. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  12. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  13. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  14. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  15. </Canvas>
复制代码
5. 画多边形
  1. <Canvas>
  2. <Canvas>
  3. <Canvas>
  4. <Canvas>
  5. <Canvas>
  6. <Canvas>
  7. <Canvas>
  8.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  9. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  10. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  11. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  12. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  13. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  14. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  15. </Canvas>
复制代码
6. 画文字
  1. <Canvas>
  2. <Canvas>
  3. <Canvas>
  4. <Canvas>
  5. <Canvas>
  6. <Canvas>
  7. <Canvas>
  8.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  9. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  10. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  11. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  12. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  13. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  14. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  15. </Canvas>
复制代码
7. 画图片
  1. <Canvas>
  2. <Canvas>
  3. <Canvas>
  4. <Canvas>
  5. <Canvas>
  6. <Canvas>
  7. <Canvas>
  8.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  9. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  10. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  11. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  12. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  13. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  14. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  15. </Canvas>
复制代码
8. 画路径
  1. <Canvas>
  2. <Canvas>
  3. <Canvas>
  4. <Canvas>
  5. <Canvas>
  6. <Canvas>
  7. <Canvas>
  8.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  9. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  10. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  11. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  12. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  13. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  14. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  15. </Canvas><Canvas>
  16. <Canvas>
  17. <Canvas>
  18. <Canvas>
  19. <Canvas>
  20. <Canvas>
  21. <Canvas>
  22.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  23. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  24. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  25. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  26. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  27. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  28. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  29. </Canvas><Canvas>
  30. <Canvas>
  31. <Canvas>
  32. <Canvas>
  33. <Canvas>
  34. <Canvas>
  35. <Canvas>
  36.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  37. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  38. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  39. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  40. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  41. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  42. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  43. </Canvas><Canvas>
  44. <Canvas>
  45. <Canvas>
  46. <Canvas>
  47. <Canvas>
  48. <Canvas>
  49. <Canvas>
  50.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  51. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  52. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  53. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  54. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  55. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  56. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  57. </Canvas><Canvas>
  58. <Canvas>
  59. <Canvas>
  60. <Canvas>
  61. <Canvas>
  62. <Canvas>
  63. <Canvas>
  64.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  65. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  66. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  67. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  68. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  69. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  70. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  71. </Canvas><Canvas>
  72. <Canvas>
  73. <Canvas>
  74. <Canvas>
  75. <Canvas>
  76. <Canvas>
  77. <Canvas>
  78.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  79. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  80. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  81. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  82. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  83. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  84. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  85. </Canvas><Canvas>
  86. <Canvas>
  87. <Canvas>
  88. <Canvas>
  89. <Canvas>
  90. <Canvas>
  91. <Canvas>
  92.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  93. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  94. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  95. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  96. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  97. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  98. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  99. </Canvas><Canvas>
  100. <Canvas>
  101. <Canvas>
  102. <Canvas>
  103. <Canvas>
  104. <Canvas>
  105. <Canvas>
  106.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  107. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  108. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  109. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  110. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  111. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  112. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  113. </Canvas><Canvas>
  114. <Canvas>
  115. <Canvas>
  116. <Canvas>
  117. <Canvas>
  118. <Canvas>
  119. <Canvas>
  120.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  121. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  122. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  123. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  124. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  125. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  126. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  127. </Canvas><Canvas>
  128. <Canvas>
  129. <Canvas>
  130. <Canvas>
  131. <Canvas>
  132. <Canvas>
  133. <Canvas>
  134.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  135. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  136. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  137. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  138. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  139. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  140. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  141. </Canvas><Canvas>
  142. <Canvas>
  143. <Canvas>
  144. <Canvas>
  145. <Canvas>
  146. <Canvas>
  147. <Canvas>
  148.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  149. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  150. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  151. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  152. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  153. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  154. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  155. </Canvas><Canvas>
  156. <Canvas>
  157. <Canvas>
  158. <Canvas>
  159. <Canvas>
  160. <Canvas>
  161. <Canvas>
  162.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  163. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  164. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  165. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  166. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  167. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  168. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  169. </Canvas><Canvas>
  170. <Canvas>
  171. <Canvas>
  172. <Canvas>
  173. <Canvas>
  174. <Canvas>
  175. <Canvas>
  176.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  177. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  178. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  179. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  180. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  181. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  182. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  183. </Canvas><Canvas>
  184. <Canvas>
  185. <Canvas>
  186. <Canvas>
  187. <Canvas>
  188. <Canvas>
  189. <Canvas>
  190.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  191. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  192. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  193. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  194. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  195. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  196. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  197. </Canvas><Canvas>
  198. <Canvas>
  199. <Canvas>
  200. <Canvas>
  201. <Canvas>
  202. <Canvas>
  203. <Canvas>
  204.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  205. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  206. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  207. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  208. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  209. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  210. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  211. </Canvas><Canvas>
  212. <Canvas>
  213. <Canvas>
  214. <Canvas>
  215. <Canvas>
  216. <Canvas>
  217. <Canvas>
  218.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  219. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  220. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  221. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  222. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  223. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  224. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  225. </Canvas><Canvas>
  226. <Canvas>
  227. <Canvas>
  228. <Canvas>
  229. <Canvas>
  230. <Canvas>
  231. <Canvas>
  232.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  233. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  234. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  235. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  236. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  237. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  238. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  239. </Canvas><Canvas>
  240. <Canvas>
  241. <Canvas>
  242. <Canvas>
  243. <Canvas>
  244. <Canvas>
  245. <Canvas>
  246.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  247. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  248. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  249. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  250. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  251. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  252. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  253. </Canvas><Canvas>
  254. <Canvas>
  255. <Canvas>
  256. <Canvas>
  257. <Canvas>
  258. <Canvas>
  259. <Canvas>
  260.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  261. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  262. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  263. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  264. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  265. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  266. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  267. </Canvas><Canvas>
  268. <Canvas>
  269. <Canvas>
  270. <Canvas>
  271. <Canvas>
  272. <Canvas>
  273. <Canvas>
  274.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  275. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  276. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  277. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  278. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  279. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  280. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  281. </Canvas><Canvas>
  282. <Canvas>
  283. <Canvas>
  284. <Canvas>
  285. <Canvas>
  286. <Canvas>
  287. <Canvas>
  288.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  289. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  290. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  291. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  292. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  293. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  294. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  295. </Canvas><Canvas>
  296. <Canvas>
  297. <Canvas>
  298. <Canvas>
  299. <Canvas>
  300. <Canvas>
  301. <Canvas>
  302.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  303. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  304. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  305. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  306. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  307. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  308. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  309. </Canvas><Canvas>
  310. <Canvas>
  311. <Canvas>
  312. <Canvas>
  313. <Canvas>
  314. <Canvas>
  315. <Canvas>
  316.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  317. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  318. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  319. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  320. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  321. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  322. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  323. </Canvas><Canvas>
  324. <Canvas>
  325. <Canvas>
  326. <Canvas>
  327. <Canvas>
  328. <Canvas>
  329. <Canvas>
  330.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  331. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  332. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  333. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  334. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  335. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  336. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  337. </Canvas><Canvas>
  338. <Canvas>
  339. <Canvas>
  340. <Canvas>
  341. <Canvas>
  342. <Canvas>
  343. <Canvas>
  344.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  345. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  346. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  347. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  348. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  349. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  350. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  351. </Canvas><Canvas>
  352. <Canvas>
  353. <Canvas>
  354. <Canvas>
  355. <Canvas>
  356. <Canvas>
  357. <Canvas>
  358.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  359. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  360. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  361. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  362. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  363. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  364. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  365. </Canvas><Canvas>
  366. <Canvas>
  367. <Canvas>
  368. <Canvas>
  369. <Canvas>
  370. <Canvas>
  371. <Canvas>
  372.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  373. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  374. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  375. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  376. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  377. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  378. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  379. </Canvas><Canvas>
  380. <Canvas>
  381. <Canvas>
  382. <Canvas>
  383. <Canvas>
  384. <Canvas>
  385. <Canvas>
  386.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  387. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  388. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  389. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  390. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  391. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  392. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  393. </Canvas><Canvas>
  394. <Canvas>
  395. <Canvas>
  396. <Canvas>
  397. <Canvas>
  398. <Canvas>
  399. <Canvas>
  400.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  401. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  402. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  403. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  404. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  405. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  406. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  407. </Canvas><Canvas>
  408. <Canvas>
  409. <Canvas>
  410. <Canvas>
  411. <Canvas>
  412. <Canvas>
  413. <Canvas>
  414.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  415. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  416. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  417. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  418. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  419. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  420. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  421. </Canvas>
复制代码
9. 画曲线
  1. <Canvas>
  2. <Canvas>
  3. <Canvas>
  4. <Canvas>
  5. <Canvas>
  6. <Canvas>
  7. <Canvas>
  8.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  9. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  10. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  11. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  12. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  13. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  14. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  15. </Canvas><Canvas>
  16. <Canvas>
  17. <Canvas>
  18. <Canvas>
  19. <Canvas>
  20. <Canvas>
  21. <Canvas>
  22.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  23. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  24. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  25. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  26. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  27. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  28. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  29. </Canvas><Canvas>
  30. <Canvas>
  31. <Canvas>
  32. <Canvas>
  33. <Canvas>
  34. <Canvas>
  35. <Canvas>
  36.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  37. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  38. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  39. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  40. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  41. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  42. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  43. </Canvas><Canvas>
  44. <Canvas>
  45. <Canvas>
  46. <Canvas>
  47. <Canvas>
  48. <Canvas>
  49. <Canvas>
  50.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  51. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  52. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  53. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  54. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  55. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  56. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  57. </Canvas><Canvas>
  58. <Canvas>
  59. <Canvas>
  60. <Canvas>
  61. <Canvas>
  62. <Canvas>
  63. <Canvas>
  64.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  65. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  66. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  67. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  68. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  69. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  70. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  71. </Canvas><Canvas>
  72. <Canvas>
  73. <Canvas>
  74. <Canvas>
  75. <Canvas>
  76. <Canvas>
  77. <Canvas>
  78.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  79. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  80. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  81. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  82. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  83. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  84. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  85. </Canvas><Canvas>
  86. <Canvas>
  87. <Canvas>
  88. <Canvas>
  89. <Canvas>
  90. <Canvas>
  91. <Canvas>
  92.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  93. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  94. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  95. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  96. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  97. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  98. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  99. </Canvas><Canvas>
  100. <Canvas>
  101. <Canvas>
  102. <Canvas>
  103. <Canvas>
  104. <Canvas>
  105. <Canvas>
  106.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  107. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  108. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  109. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  110. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  111. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  112. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  113. </Canvas><Canvas>
  114. <Canvas>
  115. <Canvas>
  116. <Canvas>
  117. <Canvas>
  118. <Canvas>
  119. <Canvas>
  120.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  121. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  122. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  123. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  124. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  125. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  126. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  127. </Canvas><Canvas>
  128. <Canvas>
  129. <Canvas>
  130. <Canvas>
  131. <Canvas>
  132. <Canvas>
  133. <Canvas>
  134.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  135. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  136. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  137. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  138. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  139. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  140. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  141. </Canvas><Canvas>
  142. <Canvas>
  143. <Canvas>
  144. <Canvas>
  145. <Canvas>
  146. <Canvas>
  147. <Canvas>
  148.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  149. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  150. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  151. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  152. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  153. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  154. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  155. </Canvas><Canvas>
  156. <Canvas>
  157. <Canvas>
  158. <Canvas>
  159. <Canvas>
  160. <Canvas>
  161. <Canvas>
  162.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  163. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  164. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  165. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  166. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  167. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  168. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  169. </Canvas><Canvas>
  170. <Canvas>
  171. <Canvas>
  172. <Canvas>
  173. <Canvas>
  174. <Canvas>
  175. <Canvas>
  176.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  177. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  178. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  179. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  180. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  181. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  182. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  183. </Canvas><Canvas>
  184. <Canvas>
  185. <Canvas>
  186. <Canvas>
  187. <Canvas>
  188. <Canvas>
  189. <Canvas>
  190.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  191. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  192. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  193. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  194. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  195. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  196. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  197. </Canvas><Canvas>
  198. <Canvas>
  199. <Canvas>
  200. <Canvas>
  201. <Canvas>
  202. <Canvas>
  203. <Canvas>
  204.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  205. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  206. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  207. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  208. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  209. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  210. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  211. </Canvas><Canvas>
  212. <Canvas>
  213. <Canvas>
  214. <Canvas>
  215. <Canvas>
  216. <Canvas>
  217. <Canvas>
  218.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  219. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  220. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  221. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  222. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  223. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  224. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  225. </Canvas><Canvas>
  226. <Canvas>
  227. <Canvas>
  228. <Canvas>
  229. <Canvas>
  230. <Canvas>
  231. <Canvas>
  232.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  233. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  234. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  235. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  236. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  237. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  238. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  239. </Canvas><Canvas>
  240. <Canvas>
  241. <Canvas>
  242. <Canvas>
  243. <Canvas>
  244. <Canvas>
  245. <Canvas>
  246.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  247. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  248. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  249. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  250. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  251. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  252. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  253. </Canvas><Canvas>
  254. <Canvas>
  255. <Canvas>
  256. <Canvas>
  257. <Canvas>
  258. <Canvas>
  259. <Canvas>
  260.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  261. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  262. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  263. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  264. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  265. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  266. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  267. </Canvas><Canvas>
  268. <Canvas>
  269. <Canvas>
  270. <Canvas>
  271. <Canvas>
  272. <Canvas>
  273. <Canvas>
  274.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  275. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  276. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  277. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  278. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  279. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  280. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  281. </Canvas><Canvas>
  282. <Canvas>
  283. <Canvas>
  284. <Canvas>
  285. <Canvas>
  286. <Canvas>
  287. <Canvas>
  288.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  289. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  290. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  291. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  292. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  293. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  294. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  295. </Canvas><Canvas>
  296. <Canvas>
  297. <Canvas>
  298. <Canvas>
  299. <Canvas>
  300. <Canvas>
  301. <Canvas>
  302.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  303. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  304. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  305. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  306. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  307. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  308. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  309. </Canvas><Canvas>
  310. <Canvas>
  311. <Canvas>
  312. <Canvas>
  313. <Canvas>
  314. <Canvas>
  315. <Canvas>
  316.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  317. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  318. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  319. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  320. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  321. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  322. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  323. </Canvas><Canvas>
  324. <Canvas>
  325. <Canvas>
  326. <Canvas>
  327. <Canvas>
  328. <Canvas>
  329. <Canvas>
  330.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  331. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  332. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  333. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  334. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  335. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  336. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  337. </Canvas><Canvas>
  338. <Canvas>
  339. <Canvas>
  340. <Canvas>
  341. <Canvas>
  342. <Canvas>
  343. <Canvas>
  344.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  345. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  346. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  347. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  348. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  349. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  350. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  351. </Canvas>
复制代码
10. 画贝塞尔曲线
  1. <Canvas>
  2. <Canvas>
  3. <Canvas>
  4. <Canvas>
  5. <Canvas>
  6. <Canvas>
  7. <Canvas>
  8.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  9. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  10. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  11. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  12. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  13. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  14. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  15. </Canvas><Canvas>
  16. <Canvas>
  17. <Canvas>
  18. <Canvas>
  19. <Canvas>
  20. <Canvas>
  21. <Canvas>
  22.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  23. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  24. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  25. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  26. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  27. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  28. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  29. </Canvas><Canvas>
  30. <Canvas>
  31. <Canvas>
  32. <Canvas>
  33. <Canvas>
  34. <Canvas>
  35. <Canvas>
  36.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  37. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  38. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  39. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  40. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  41. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  42. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  43. </Canvas><Canvas>
  44. <Canvas>
  45. <Canvas>
  46. <Canvas>
  47. <Canvas>
  48. <Canvas>
  49. <Canvas>
  50.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  51. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  52. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  53. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  54. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  55. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  56. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  57. </Canvas><Canvas>
  58. <Canvas>
  59. <Canvas>
  60. <Canvas>
  61. <Canvas>
  62. <Canvas>
  63. <Canvas>
  64.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  65. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  66. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  67. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  68. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  69. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  70. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  71. </Canvas><Canvas>
  72. <Canvas>
  73. <Canvas>
  74. <Canvas>
  75. <Canvas>
  76. <Canvas>
  77. <Canvas>
  78.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  79. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  80. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  81. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  82. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  83. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  84. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  85. </Canvas><Canvas>
  86. <Canvas>
  87. <Canvas>
  88. <Canvas>
  89. <Canvas>
  90. <Canvas>
  91. <Canvas>
  92.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  93. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  94. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  95. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  96. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  97. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  98. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  99. </Canvas><Canvas>
  100. <Canvas>
  101. <Canvas>
  102. <Canvas>
  103. <Canvas>
  104. <Canvas>
  105. <Canvas>
  106.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  107. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  108. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  109. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  110. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  111. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  112. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  113. </Canvas><Canvas>
  114. <Canvas>
  115. <Canvas>
  116. <Canvas>
  117. <Canvas>
  118. <Canvas>
  119. <Canvas>
  120.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  121. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  122. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  123. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  124. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  125. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  126. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  127. </Canvas><Canvas>
  128. <Canvas>
  129. <Canvas>
  130. <Canvas>
  131. <Canvas>
  132. <Canvas>
  133. <Canvas>
  134.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  135. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  136. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  137. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  138. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  139. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  140. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  141. </Canvas><Canvas>
  142. <Canvas>
  143. <Canvas>
  144. <Canvas>
  145. <Canvas>
  146. <Canvas>
  147. <Canvas>
  148.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  149. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  150. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  151. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  152. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  153. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  154. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  155. </Canvas><Canvas>
  156. <Canvas>
  157. <Canvas>
  158. <Canvas>
  159. <Canvas>
  160. <Canvas>
  161. <Canvas>
  162.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  163. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  164. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  165. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  166. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  167. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  168. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  169. </Canvas><Canvas>
  170. <Canvas>
  171. <Canvas>
  172. <Canvas>
  173. <Canvas>
  174. <Canvas>
  175. <Canvas>
  176.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  177. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  178. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  179. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  180. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  181. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  182. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  183. </Canvas><Canvas>
  184. <Canvas>
  185. <Canvas>
  186. <Canvas>
  187. <Canvas>
  188. <Canvas>
  189. <Canvas>
  190.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  191. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  192. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  193. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  194. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  195. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  196. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  197. </Canvas><Canvas>
  198. <Canvas>
  199. <Canvas>
  200. <Canvas>
  201. <Canvas>
  202. <Canvas>
  203. <Canvas>
  204.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  205. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  206. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  207. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  208. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  209. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  210. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  211. </Canvas><Canvas>
  212. <Canvas>
  213. <Canvas>
  214. <Canvas>
  215. <Canvas>
  216. <Canvas>
  217. <Canvas>
  218.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  219. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  220. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  221. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  222. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  223. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  224. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  225. </Canvas><Canvas>
  226. <Canvas>
  227. <Canvas>
  228. <Canvas>
  229. <Canvas>
  230. <Canvas>
  231. <Canvas>
  232.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  233. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  234. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  235. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  236. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  237. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  238. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  239. </Canvas><Canvas>
  240. <Canvas>
  241. <Canvas>
  242. <Canvas>
  243. <Canvas>
  244. <Canvas>
  245. <Canvas>
  246.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  247. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  248. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  249. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  250. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  251. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  252. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  253. </Canvas><Canvas>
  254. <Canvas>
  255. <Canvas>
  256. <Canvas>
  257. <Canvas>
  258. <Canvas>
  259. <Canvas>
  260.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  261. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  262. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  263. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  264. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  265. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  266. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  267. </Canvas><Canvas>
  268. <Canvas>
  269. <Canvas>
  270. <Canvas>
  271. <Canvas>
  272. <Canvas>
  273. <Canvas>
  274.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  275. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  276. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  277. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  278. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  279. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  280. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  281. </Canvas><Canvas>
  282. <Canvas>
  283. <Canvas>
  284. <Canvas>
  285. <Canvas>
  286. <Canvas>
  287. <Canvas>
  288.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  289. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  290. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  291. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  292. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  293. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  294. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  295. </Canvas><Canvas>
  296. <Canvas>
  297. <Canvas>
  298. <Canvas>
  299. <Canvas>
  300. <Canvas>
  301. <Canvas>
  302.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  303. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  304. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  305. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  306. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  307. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  308. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  309. </Canvas><Canvas>
  310. <Canvas>
  311. <Canvas>
  312. <Canvas>
  313. <Canvas>
  314. <Canvas>
  315. <Canvas>
  316.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  317. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  318. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  319. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  320. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  321. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  322. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  323. </Canvas><Canvas>
  324. <Canvas>
  325. <Canvas>
  326. <Canvas>
  327. <Canvas>
  328. <Canvas>
  329. <Canvas>
  330.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  331. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  332. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  333. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  334. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  335. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  336. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  337. </Canvas><Canvas>
  338. <Canvas>
  339. <Canvas>
  340. <Canvas>
  341. <Canvas>
  342. <Canvas>
  343. <Canvas>
  344.     <Image Source="your_image_path.jpg" Width="100" Height="100"/>
  345. </Canvas><TextBlock Text="Hello WPF!" FontSize="20" Foreground="Purple"/>
  346. </Canvas><Polygon Points="0,0 50,0 50,50" Fill="Yellow"/>
  347. </Canvas><Rectangle Width="100" Height="50" Fill="Red"/>
  348. </Canvas><Ellipse Width="100" Height="50" Fill="Green"/>
  349. </Canvas><Line X1="0" Y1="0" X2="100" Y2="100" Stroke="Black" StrokeThickness="2"/>
  350. </Canvas><Ellipse Width="50" Height="50" Fill="Blue"/>
  351. </Canvas>
复制代码
以上示例中,Canvas是一个用于布局子元素的容器,你可以根据需要选择不同的容器。在实际项目中,你可能需要使用更复杂的布局,例如Grid或StackPanel。
请注意,这只是基本示例,你可以根据需求修改属性以及组合不同的元素来创建更复杂的图形。实际场景里如果想实现动画效果一般需要辅助代码来实现。
源代码:https://pan.baidu.com/s/1Rgssy7HTwL0dxPbTUeo27w?pwd=6666 
 



来源:https://www.cnblogs.com/hanbing81868164/p/18069741
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x

举报 回复 使用道具