Hi Michael,
thank you for your suggestion - I'll add this to our list of features to consider for one of the next releases. In the current version, the focus of the stylus and Tablet features has been on integrated digitizers (e.g. Tablet PC scenarios). With integrated digitizers the input is always mapped to the whole screen.
In the current version we actually do allow re-mapping stylus input within a given UIElement. To accomplish this you can add your own System.Windows.Input.StylusPlugin object to your UIElement's StylusPlugins collection. In that plug-in you can remap the x,y data (see code sample below). As an example, you could use a transparent, custom InkCanvas in a Window that sits on top of your application. That InkCanvas could remap the stylus input to a specified target region - allowing you to draw on a small area of the app wile using the full area on your digitizer pad.
Thanks, Stefan Wick
public class RemapPlugin : StylusPlugIn { public RemapPlugin() { _matrix = new Matrix(); _matrix.Scale(0.5d, 0.5d); _matrix.Translate(200d, 200d); }
void OnRawStylusInput(RawStylusInput args) { StylusPointCollection stylusPoints = args.GetStylusPoints(); for (int x = 0; x < stylusPoints.Count; x++) { StylusPoint sp = stylusPoints[x]; Point pt = (Point)sp; pt *= _matrix; sp.X = pt.X; sp.Y = pt.Y; stylusPoints[x] = sp; } args.SetStylusPoints(stylusPoints); }
protected override void OnStylusDown(RawStylusInput rawStylusInput) { OnRawStylusInput(rawStylusInput); base.OnStylusDown(rawStylusInput); }
protected override void OnStylusMove(RawStylusInput rawStylusInput) { OnRawStylusInput(rawStylusInput); base.OnStylusMove(rawStylusInput); }
protected override void OnStylusUp(RawStylusInput rawStylusInput) { OnRawStylusInput(rawStylusInput); base.OnStylusUp(rawStylusInput); }
private Matrix _matrix; }
class RemapInkCanvas : InkCanvas { public RemapInkCanvas() { this.StylusPlugIns.Insert(0, new RemapPlugin()); } }
|