简体   繁体   English

C# 和 WPF:用于基本绘图的简单二维区域

[英]C# and WPF : simple 2D area for basic drawing

Using JavaFX, I created a class which inherits Canvas and reimplemented the update() method to get a GraphicsContext2D , with which I could use simple drawing primitives like strokeLine() , fillArc() , fillOval() , etc. Using JavaFX, I created a class which inherits Canvas and reimplemented the update() method to get a GraphicsContext2D , with which I could use simple drawing primitives like strokeLine() , fillArc() , fillOval() , etc.

What would be the equivalent in C# using WPF?使用 WPF 在 C# 中的等价物是什么?

In wpf there is also Canvas from which you can inherit and implement your addition logic.在 wpf 中还有 Canvas 可以从中继承和实现添加逻辑。 Also wpf has InkCanvas with some default implementation which you can also extend. wpf 也有 InkCanvas 和一些你也可以扩展的默认实现。 Look at https://github.com/antfu/live-draw for example with InkCanvas.以 InkCanvas 为例,查看https://github.com/antfu/live-draw

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM