HP Dx9000 Resources for Developing Touch-Friendly Applications for HP Business - Page 22
Windows 7 Multi-touch Using WPF
UPC - 884420541578
View all HP Dx9000 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 22 highlights
Touch2ID = e.StylusDevice.Id; // move the rectangle to the given location Touch2.SetValue(Canvas.LeftProperty, p.X - Touch2.Width / 2); Touch2.SetValue(Canvas.TopProperty, p.Y - Touch2.Height / 2); } } void Window1_StylusMove(object sender, StylusEventArgs e) { Point p = e.GetPosition(this); // determine which contact this belongs to if (Touch1ID == e.StylusDevice.Id) { // move the rectangle to the given location Touch1.SetValue(Canvas.LeftProperty, p.X - Touch1.Width / 2); Touch1.SetValue(Canvas.TopProperty, p.Y - Touch1.Height / 2); } else if (Touch2ID == e.StylusDevice.Id) { // move the rectangle to the given location Touch2.SetValue(Canvas.LeftProperty, p.X - Touch2.Width / 2); Touch2.SetValue(Canvas.TopProperty, p.Y - Touch2.Height / 2); } } void Window1_StylusUp(object sender, StylusEventArgs e) { // reinitialize touch id and hide the rectangle if (e.StylusDevice.Id == Touch1ID) { Touch1.SetValue(Canvas.LeftProperty, -Touch1.Width); Touch1ID = 0; } else if (e.StylusDevice.Id == Touch2ID) { Touch2.SetValue(Canvas.LeftProperty, -Touch2.Width); Touch2ID = 0; } } #endregion } } The full blog, Windows 7 Multi-touch Using WPF, is available at http://blog.andreweichacker.com/2009/02/windows-7-multi-touch-using-wpf/. 22