为什么要在 WPF 中使用 InkCanvas?

发布于 2024-08-24 15:09:39 字数 277 浏览 4 评论 0原文

在我的 WPF 应用程序中,我有一些绘图功能。我已经使用 Canvas 并手动处理鼠标手势解决了这个问题,并且还将绘制的笔画(包装在 InkPresenter 中)添加到了该 Canvas 中。

使用Blend我突然发现有一个东西叫InkCanvas。根据 Blend 的说法,这是一个“定义接收和显示墨迹笔划的区域。”的控件,因此它听起来与我所做的事情相关。但使用普通画布似乎一切都工作正常

。 InkCanvas 与普通 Canvas 有何不同,为什么我应该选择使用它?

In my WPF application I have some drawing functionality. I have solved this using a Canvas and handling mouse gestures manually, and I also add the drawn Strokes (wrapped in InkPresenter) to this Canvas.

Using Blend I suddenly discover that there is something called InkCanvas. According to Blend this is a control that "Defines an area that receives and displays ink strokes.", so it sounds relevant to what I do. But everything seems to work fine using a plain Canvas..

So; how does the InkCanvas differ from the plain Canvas, and why should I choose to use this instead?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

你列表最软的妹 2024-08-31 15:09:39

它们实际上是为了服务于两个不同的目的。 Canvas 用于布局。特别是为了使用绝对定位更精确地控制布局。如您所知,InkCanvas 用于捕获和显示笔画。

您所做的一切都很好,但是 InkCanvas 有一些不错的附加功能,例如 EditMode 等。它的目的是让您免于使用 Canvas 手动编写大量内容。使用 Canvas 是一种您自己的方法,其中 InkCanvas 是一种使用预构建的方法。

They really are meant to serve two different purposes. Canvas is for layout. Specifically for more exact control over layout using absolute positioning. InkCanvas is, as you know, for capturing and displaying strokes.

What you are doing is just fine, but InkCanvas has some nice additional features like EditMode among others. It is meant to save you from writing a lot of the stuff you would have to do by hand using Canvas. Using Canvas is a roll your own kind of approach where InkCanvas is a use a pre-built in kind of approach.

胡大本事 2024-08-31 15:09:39

InkCanvas 处理鼠标事件以便您在画布上绘图。它还具有以下功能:

  • 保存/加载
  • 调整大小/缩放
  • 突出显示文本后面
  • 橡皮擦模式

http://www.kirupa.com/blend_wpf/inkcanvas_pg1.htm

An InkCanvas handles the mouse events for you to draw on the canvas. It also has this functionality:

  • Save/Load
  • Resize/Scale
  • Highlight behind text
  • Eraser mode

http://www.kirupa.com/blend_wpf/inkcanvas_pg1.htm

古镇旧梦 2024-08-31 15:09:39

就性能而言,具有真实鼠标事件的 InkCanvas 比从 StylusPointCollection 中创建笔画要快得多,我发现向 StylusPointCollection 添加新点是一项昂贵的操作。

When performance in concerned, InkCanvas with real mouse events is much faster than creating a stroke out of StylusPointCollection, I found that adding new points to a StylusPointCollection is an expensive operation.

Saygoodbye 2024-08-31 15:09:39

我们可以使用 InkCanvas WPF 开发白板应用程序、绘画应用程序。
EditMode 为我们提供了很多功能,例如
手势、绘图、擦除、多点触摸操作、选择元素拖放选项。
插入形状、图像、视频、笔画注释等元素
我们可以保存/加载所有笔画和元素。
我们可以自定义 InkCanvas 类。

we can develop whiteboard application,paint application using InkCanvas WPF.
EditMode gives us so many features like
Gestures,drawing,,erasing,multi touch operations,select element drag drop options.
insert elements like shapes,images,videos,stroke annotations
we can save/load all strokes and elements.
we can customise InkCanvas class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文