New to Telerik UI for WinForms? Download free 30-day trial

Adding a Canvas for Free Hand Typing in WinForms Apps

Environment

Product Version Product Author
2024.2.514 UI for WinForms Dinko Krastev

Description

This KB article demonstrates how we can implement a freehand drawing canvas in WinForms.

Solution

To achieve free hand typing or drawing in a WinForms application, we can use the InkCanvas element. To add the WPF object in WinForms Form, we can use the ElementHost class.

Note that InkCanvas is not a native WinForms control and requires additional assemblies (PresentationCore, PresentationFramework, and WindowsFormsIntegration) to integrate with WinForms.

To use InkCanvas in a WinForms application, follow these steps:

     ElementHost host = new ElementHost();
     host.Dock = DockStyle.Fill;
     InkCanvas ic = new InkCanvas();
     host.Child = ic;
     this.radPanel1.Controls.Add(host);

See Also

In this article