문제

From what I understand so far, the InkCanvas element is in the WPF Framework. To use that, I need an ElementHost control to host the InkCanvas element. I've been to the MSDN links, but the example it gives talks of creating a WPF User Control Library project and so on. It's not that bad, but it seems a bit much to just add a control to a Winform. Is there a simpler way to do this, or am I trying to oversimplify this?

Thanks.

도움이 되었습니까?

해결책

This should work:

ElementHost host = new ElementHost();
InkCanvas ic = new InkCanvas();
host.Child = ic;
Controls.Add(host);

As mentioned in comments, one needs to add the WPF assemblies as reference (WindowsBase, PresentationCore, PresentationFramework).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top