我正在使用.Net 4.0 WPF。我想使用InkCanvas收集用户输入,然后识别输入的字符。 谷歌搜索后,我在http://msdn.microsoft.com/zh-cn/library/ms754080.aspx找到了一个解决方案 不幸的是,它适用于.net 3.5。是否有针对.net 4.0的解决方案?感谢。
===================
从http://www.microsoft.com/en-us/download/details.aspx?id=20989下载TablePC SDK 然后得到了Micorsoft.Ink.dll。以下是示例代码......
using Microsoft.Ink;
using System.IO;
private void btnGetInput_Click(object sender, RoutedEventArgs e)
{
if (inkInput.Strokes.Count > 0)
{
System.Windows.Ink.StrokeCollection strokeList = inkInput.Strokes;
MemoryStream ms = new MemoryStream();
inkInput.Strokes.Save(ms);
InkCollector myInkCollector = new InkCollector();
Ink ink = new Ink();
ink.Load(ms.ToArray());
using (RecognizerContext myRecoContext = new RecognizerContext())
{
RecognitionStatus status;
RecognitionResult recoResult;
myRecoContext.Strokes = ink.Strokes;
recoResult = myRecoContext.Recognize(out status);
tbUserName.Text += recoResult.TopString;
}
inkInput.Strokes.Clear();
}
}