protected void GetStylusParams(StylusPointDescription sd) { if (sd.HasProperty(StylusPointProperties.XTiltOrientation) && sd.HasProperty(StylusPointProperties.YTiltOrientation)) { StylusPointPropertyInfo tiltXInfo = sd.GetPropertyInfo(StylusPointProperties.XTiltOrientation); StylusPointPropertyInfo tiltYInfo = sd.GetPropertyInfo(StylusPointProperties.YTiltOrientation); mInputMinTiltX = tiltXInfo.Minimum; mInputMaxTiltX = tiltXInfo.Maximum; mInputMinTiltY = tiltYInfo.Minimum; mInputMaxTiltY = tiltYInfo.Maximum; mScaleTiltX = (mTargetMaxTiltX - mTargetMinTiltX) / (mInputMaxTiltX - mInputMinTiltX); mScaleTiltY = (mTargetMaxTiltY - mTargetMinTiltY) / (mInputMaxTiltY - mInputMinTiltY); } else { mScaleTiltX = 0; mScaleTiltY = 0; } }
// <Snippet21> void inkCanvas1_StylusMove(object sender, StylusEventArgs e) { StylusPointCollection points = e.GetStylusPoints(inkCanvas1); StylusPointDescription description = points.Description; StringWriter normalPressureInfo = new StringWriter(); if (description.HasProperty(StylusPointProperties.NormalPressure)) { StylusPointPropertyInfo propertyInfo = description.GetPropertyInfo(StylusPointProperties.NormalPressure); normalPressureInfo.WriteLine(" Guid = {0}", propertyInfo.Id.ToString()); normalPressureInfo.Write(" Min = {0}", propertyInfo.Minimum.ToString()); normalPressureInfo.Write(" Max = {0}", propertyInfo.Maximum.ToString()); normalPressureInfo.Write(" Unit = {0}", propertyInfo.Unit.ToString()); normalPressureInfo.WriteLine(" Res = {0}", propertyInfo.Resolution.ToString()); } }