日期:2014-05-18 浏览次数:20946 次
//添加对 WPF 墨迹分析程序集、IAWinFX.dll、IACore.dll 和 IALoader.dll(这些内容可以在 \Program Files\Reference Assemblies\Microsoft\Tablet PC\v1.7 中找到)的引用。 using System.Windows.Ink; // Recognizes handwriting by using RecognizerContext private void buttonClick(object sender, RoutedEventArgs e) { InkAnalyzer theInkAnalyzer = new InkAnalyzer(); theInkAnalyzer.AddStrokes(theInkCanvas.Strokes); theInkAnalyzer.SetStrokesLanguageId(theInkCanvas.Strokes, 0x0804); // 0x0804 简体中文 theInkAnalyzer.SetStrokesType(theInkCanvas.Strokes, StrokeType.Writing); AnalysisStatus status = theInkAnalyzer.Analyze(); if (status.Successful) { //textBox1.Text = theInkAnalyzer.GetRecognizedString(); textBox1.Text = ""; for (int i = 0; i < theInkAnalyzer.GetAlternates().Count; i++) { textBox1.Text += theInkAnalyzer.GetAlternates()[i].RecognizedString; } } else { MessageBox.Show("识别失败"); } }