/// <summary> /// Event Handle recognize button click event /// </summary> /// <param name="sender">The control that raised the event.</param> /// <param name="e">The event arguments.</param> private void btnRecognize_Click(object sender, System.EventArgs e) { // Check to ensure that the user has at least one recognizer installed // Note that this is a preventive check - otherwise, an exception will // occur during recognition. if (0 == myRecognizers.Count) { MessageBox.Show("There are no handwriting recognizers installed. You need to have at least one in order to recognize ink."); } else { // Note that the Strokes' ToString() method is a // shortcut for retrieving the best match using the // default recognizer. The same result can also be // obtained using the RecognizerContext. For an // example, uncomment the following lines of code: // RecognizerContext myRecoContext = new RecognizerContext(); myRecoContext.Factoid = "(0|1|X)"; RecognitionStatus status; RecognitionResult recoResult; // myRecoContext.Strokes = myInkCollector.Ink.Strokes; recoResult = myRecoContext.Recognize(out status); txtResults.SelectedText = recoResult.TopString; //txtResults.SelectedText = myInkCollector.Ink.Strokes.ToString(); // If the mouse is pressed, do not perform the deletion - // this prevents deleting a stroke that is still being drawn if (!myInkCollector.CollectingInk) { // Once the strokes have been recognized, delete them myInkCollector.Ink.DeleteStrokes(); // Repaint the drawing area gbInkArea.Refresh(); } } }