How to draw on canvas in the subway using C # and XAML

I want my user to be able to draw their signature on a canvas in a Windows 8 Metro application.

Does anyone know any examples using C # and XAML?

+7
source share
4 answers
+6
source

You can use the Canvas panel and track all pointer events, such as PointerPressed / Moved / Exit / Entered / Excited. Make sure you track all pointers by identifier (call e.GetCurrentPoint (myCanvas) to get the identifier of the pointer), as you may have more pointing devices than just a mouse. Then just add some forms from the Windows.UI.Xaml.Shapes namespace, like Line to the canvas, and you have a drawing. The problem you may encounter is that you want to save the image because the WriteableBitmap.Render () method of the previous XAML-based user interfaces is not available in WinRT. WriteableBitmapEx , which recently got a version of WinRT , can help you there.

+5
source

This link explains how to achieve what you want. Quick start: capture ink data with clear, save and load functions here full code

0
source

do this in the XAML code grid:

<Canvas> <Rectangle Width="80" Height="80" Fill="Red" Canvas.Left="80" Canvas.Top="80" /> </Canvas> 

then run your code and it will have a 80x80y square.

-4
source

All Articles