private void StylusMoving(object sender, StylusEventArgs e) { StylusPointCollection stylusPoints = null; stylusPoints = e.GetStylusPoints(inkCanv); float currentPressure = stylusPoints[0].PressureFactor; txtPressure.Text = currentPressure.ToString(); System.Windows.Ink.DrawingAttributes inkDA = new System.Windows.Ink.DrawingAttributes(); inkDA.Height = 4; inkDA.Width = 4; inkDA.FitToCurve = false; int press = Convert.ToInt32(currentPressure * 100); if (press >= 0 && press <= 20) { inkDA.Color = Colors.Green; } else if (press >= 21 && press <= 40) { inkDA.Color = Colors.Orange; } else if (press >= 41 && press <= 60) { inkDA.Color = Colors.Blue; } else if (press >= 61 && press <= 80) { inkDA.Color = Colors.Red; } else if (press >= 81 && press <= 100) { inkDA.Color = Colors.Black; } else { inkDA.Color = Colors.Green; } inkCanv.DefaultDrawingAttributes = inkDA; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)