.NET
  Home arrow .NET arrow Page 3 - Keyboard and Ink Input with WPF
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Keyboard and Ink Input with WPF
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-07-10

    Table of Contents:
  • Keyboard and Ink Input with WPF
  • Keyboard State
  • Ink Input
  • Commands

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Keyboard and Ink Input with WPF - Ink Input


    (Page 3 of 4 )

    The stylus used on Tablet PCs and other ink-enabled systems has its own set of events. Table 4-3 shows the ink input events offered by user interface elements.

    Table 4-3. Stylus and ink events

    Event

    Routing

    Meaning

    GotStylusCapture

    Bubble

    Element captured stylus.

    LostStylusCapture

    Bubble

    Element lost stylus capture.

    PreviewStylusButtonDown, StylusButtonDown

    Tunnel, Bubble

    Stylus button pressed while over element.

    PreviewStylusButtonUp, StylusButtonUp

    Tunnel, Bubble

    Stylus button released while over element.

    PreviewStylusDown, StylusDown

    Tunnel, Bubble

    Stylus touched screen while over element.

    PreviewStylusUp, StylusUp

    Tunnel, Bubble

    Stylus left screen while over element.

    StylusEnter

    Direct

    Stylus moved into element.

    StylusLeave

    Direct

    Stylus left element.

    PreviewStylusInRange, StylusInRange

    Tunnel, Bubble

    Stylus moved close enough to screen to be detected.

    PreviewStylusOutOfRange, StylusOutOfRange

    Tunnel, Bubble

    Stylus moved out of detection range.

    PreviewStylusMove, StylusMove

    Tunnel, Bubble

    Stylus moved while over element.

    PreviewStylusInAirMove, StylusInAirMove

    Tunnel, Bubble

    Stylus moved while over element but not in contact with screen. 

    PreviewStylusSystemGesture, StylusSystemGesture

    Tunnel, Bubble

    Stylus performed a gesture.

    PreviewTextInput, TextInput

    Tunnel, Bubble

    Element received text input.

    TheStylusclass provides a staticCapturemethod that works exactly the same as theMouse.Capturemethod described earlier. It also offersCaptured andDirectlyOverproperties that do the same for the stylus as the matching properties of theMouseclass do for the mouse.

    There is an alternative way of dealing with stylus input. Instead of handling all of these low-level events yourself, you can use WPF’s high-level ink handling element,InkCanvas. Example 4-14 shows how little is required to add an ink input area to a WPF application.

    Example 4-14. InkCanvas

    <InkCanvas />

    TheInkCanvas accepts free-form ink input. Figure 4-3 shows the InkCanvasin action. (It also demonstrates that I should probably stick to using the keyboard.)InkCanvasmakes all of the ink input available to your program through itsStrokes property. It is possible to connect this data to the handwriting recognition APIs in Windows, but that is beyond the scope of this book.


    Figure 4-3.  InkCanvas

    More .NET Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "Programming WPF, Second Edition,"...
     

    Buy this book now. This article is excerpted from Programming WPF, Second Edition, written by Chris Sells and Ian Griffiths (O'Reilly, 2007; ISBN: 0596510373). Check it out today at your favorite bookstore. Buy this book now.

    .NET ARTICLES

    - Building Applications with Windows Workflow ...
    - Building the Data and Business Layers Using ...
    - The Transformed XML Explorer in MFC
    - List Control and Property Grid with the MFC ...
    - Font, Shell and Masked Edit Controls for MFC
    - Color, Link and Image Editor Controls for M...
    - New Controls for MFC
    - The Windows Ribbon Framework
    - Markup Language for the Ribbon Framework
    - Visually Upgrade Your MFC Project
    - New Features for the Statusbar in MFC
    - Working with the Statusbar in MFC
    - Iron Speed Design v60 Review
    - Binary and XML Serialization
    - Using CrystalReportViewer to Display Crystal...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek