I just want the user to be able to draw on the screen with some kind of pointer.
I already have code that fixes the position of the pointer, but I canβt figure out how to place pixels or shapes or something else on the screen.
I found this useful tutorial:
http://www.dotnetspeaks.com/DisplayArticle.aspx?ID=137
And I looked at the documentation here:
http://msdn.microsoft.com/en-us/library/windows/apps/hh465055(v=VS.85).aspx
So far no luck. = (The tutorial is for Windows Phone 7, so itβs a little different. = \ Help, please? =)
And that is what I still have.
Part of the drawing:
private void Image_PointerPressed(object sender, PointerEventArgs e) { Debug.WriteLine("Image_PointerPressed"); isTracing = true; } private void Image_PointerReleased(object sender, PointerEventArgs e) { Debug.WriteLine("Image_PointerReleased"); isTracing = false; } private void Image_PointerMoved(object sender, PointerEventArgs e) { Debug.WriteLine("Image_PointerMoved"); Debug.WriteLine(e.GetCurrentPoint(this).Position); if (isTracing) { Debug.WriteLine("isTracing"); Point pos = e.GetCurrentPoint(this).Position; Color color = Colors.Green; Line line = new Line() { X1 = pos.X, X2 = pos.X + 1, Y1 = pos.Y, Y2 = pos.Y + 1 }; line.Stroke = new SolidColorBrush(color); line.StrokeThickness = 15;
For reference, material elsewhere in the code:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Multimedia.FFmpeg;
using Windows.Foundation;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.Storage.Streams;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Shapes;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Input;
using Windows.UI.Input;
bool isTracing = false;
Crystal
source share