开发者

WPF canvas drawing with Graphics

开发者 https://www.devze.com 2023-01-01 22:17 出处:网络
I\'d like to ask if 开发者_StackOverflow中文版there is any possibility to draw on WPF Canvas with some kind of a Graphics type providing methods like: DrawLine, DrawPath etc.. (as it was in .NET 2).
  1. I'd like to ask if 开发者_StackOverflow中文版there is any possibility to draw on WPF Canvas with some kind of a Graphics type providing methods like: DrawLine, DrawPath etc.. (as it was in .NET 2).

I know there's a lot of stuff like storyboards etc.. but I'm planning to do all the drawing in code behind and to have just 1 Canvas in WPF without any child elements.

  1. Do you think it is a good idea? will it be smooth ?


I'd like to ask if there is any possibility to draw on WPF Canvas with some kind of a Graphics type providing methods like: DrawLine, DrawPath etc.. (as it was in .NET 2).

Yes, you need to use the DrawingContext class

Do you think it is a good idea? will it be smooth ?

That's hard to tell, depending on your exact needs... If the canvas doesn't have any child items, I think a better solution would be to create a custom control and override the OnRender method. Regarding smoothness, it all depends on how you implement it...

0

精彩评论

暂无评论...
验证码 换一张
取 消