需microsoft.ink
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void btnRec_Click(object sender, RoutedEventArgs e)
{
InkAnalyzer theInkAnalyzer = new InkAnalyzer();
if (inkCanvas.Strokes.Count > 0)
{
AnalysisHintNode hint = theInkAnalyzer.CreateAnalysisHint();
hint.Location.MakeInfinite();
hint.Factoid = "ChineseSimpleCommon";
hint.CoerceToFactoid = true;
hint.Guide.Columns = 1;
hint.Guide.Rows = 1;
hint.Guide.Midline = 0;
hint.WordMode = true;
hint.TopInkBreaksOnly = true;
theInkAnalyzer.AddStrokes(inkCanvas.Strokes);
theInkAnalyzer.SetStrokesLanguageId(inkCanvas.Strokes, 0x0804); // 0x0804 简体中文 0x0409 美国英语 0x0412 朝鲜语(韩语)
theInkAnalyzer.SetStrokesType(inkCanvas.Strokes, StrokeType.Writing);
AnalysisStatus status = theInkAnalyzer.Analyze();
if (status.Successful)
{
textBox1.Text = theInkAnalyzer.GetRecognizedString();
}
else
{
MessageBox.Show("Recognition Failed");
}
}
}
private void btnClear_Click(object sender, RoutedEventArgs e)
{
theInkAnalyzer.RemoveStrokes(inkCanvas.Strokes);
inkCanvas.Strokes.Clear();
textBox1.Text = "";
}
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7246642/viewspace-1028572/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7246642/viewspace-1028572/