Advertisement
joapaspe

InkOverlay

Mar 15th, 2012
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1. using System.Text;
  2. using System.Windows.Forms;
  3. using Microsoft.Ink;
  4. namespace pruebaTablet
  5. {
  6.     public partial class Form1 : Form
  7.     {
  8.         InkOverlay inkOverlay;
  9.         public Form1()
  10.         {
  11.             InitializeComponent();
  12.         }
  13.  
  14.         private void Form1_Load(object sender, EventArgs e)
  15.         {
  16.             inkOverlay = new InkOverlay();
  17.             inkOverlay.Handle = this.Handle;
  18.             inkOverlay.Enabled = true;
  19.            
  20.            
  21.         }
  22.  
  23.         private void button1_Click(object sender, EventArgs e)
  24.         {
  25.  
  26.             Recognizers recs = new Recognizers();
  27.             Recognizer reco = recs.GetDefaultRecognizer();
  28.             RecognizerContext context = reco.CreateRecognizerContext();
  29.             context.Strokes = inkOverlay.Ink.Strokes;
  30.  
  31.             RecognitionStatus status = RecognitionStatus.NoError;
  32.             RecognitionResult res = context.Recognize(out status);
  33.  
  34.             if (status == RecognitionStatus.NoError)
  35.             {
  36.                 MessageBox.Show(res.TopAlternate.ToString());
  37.  
  38.             }
  39.  
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement