在msdn上面下载的,地址忘了。好像是一个就做TabletPC.exe的自解压包。 文件名称是inkrecognition(试试能搜到不)。 以下为原始内容:// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // // Copyright (c) Microsoft Corporation. All rights reserved. // // File: InkRecognition.cs // Simple Ink Recognition Sample Application // // This program demonstrates how one can build a basic handwriting // recognition application using Microsoft Tablet PC Automation API. // It first creates an InkCollector object to enable inking // in the window. Upon receiving the "Recognize!" command, fired // from the application's button, ToString() is invoked on the // collected ink strokes to retrieve the best match using the // default recognizer. The results are presented in a message box. // // The features used are: InkCollector, Ink, Strokes, // RecognizerContext, and RecognizerResult // //--------------------------------------------------------------------------using System; using System.Drawing; using System.Windows.Forms;// The Ink namespace, which contains the Tablet PC Platform API using Microsoft.Ink;namespace Microsoft.Samples.TabletPC.InkRecognition { /// <summary> /// The InkRecognition Sample Application form class /// </summary> public class InkRecognition : System.Windows.Forms.Form { // Declare the Ink Collector object private InkCollector myInkCollector = null; // myRecognizers is used to retrieve the number of installed recognizers Recognizers myRecognizers; #region Standard Template Code private System.Windows.Forms.GroupBox gbInkArea; private System.Windows.Forms.Button btnRecognize; private System.Windows.Forms.TextBox txtResults; private System.ComponentModel.Container components = null; #endregion /// <summary> /// Initialize the form and ink collector /// </summary> public InkRecognition() { #region Standard Template Code // // Required for Windows Form Designer support // InitializeComponent(); #endregion
} #region Standard Template Code /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } if (myInkCollector != null) { myInkCollector.Dispose(); } } base.Dispose( disposing ); } #endregion #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.gbInkArea = new System.Windows.Forms.GroupBox(); this.btnRecognize = new System.Windows.Forms.Button(); this.txtResults = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // gbInkArea // this.gbInkArea.Location = new System.Drawing.Point(8, 0); this.gbInkArea.Name = "gbInkArea"; this.gbInkArea.Size = new System.Drawing.Size(280, 136); this.gbInkArea.TabIndex = 0; this.gbInkArea.TabStop = false; this.gbInkArea.Text = "Ink Here"; // // btnRecognize // this.btnRecognize.Location = new System.Drawing.Point(8, 144); this.btnRecognize.Name = "btnRecognize"; this.btnRecognize.Size = new System.Drawing.Size(280, 23); this.btnRecognize.TabIndex = 1; this.btnRecognize.Text = "Recognize Ink"; this.btnRecognize.Click += new System.EventHandler(this.btnRecognize_Click); // // txtResults // this.txtResults.BackColor = System.Drawing.SystemColors.Window; this.txtResults.ForeColor = System.Drawing.SystemColors.WindowText; this.txtResults.Location = new System.Drawing.Point(8, 176); this.txtResults.Name = "txtResults"; this.txtResults.ReadOnly = true; this.txtResults.Size = new System.Drawing.Size(280, 20); this.txtResults.TabIndex = 2; this.txtResults.Text = ""; // // InkRecognition // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(292, 206); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.txtResults, this.btnRecognize, this.gbInkArea}); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.Name = "InkRecognition"; this.Text = "Ink Recognition Sample"; this.Load += new System.EventHandler(this.InkRecognition_Load); this.ResumeLayout(false); } #endregion #region Standard Template Code /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new InkRecognition()); } #endregion /// <summary> /// Event Handler from Form Load Event /// Setup the ink collector for collection /// </summary> /// <param name="sender">The control that raised the event.</param> /// <param name="e">The event arguments.</param> private void InkRecognition_Load(object sender, System.EventArgs e) { // Create the recognizers collection myRecognizers = new Recognizers(); // Create a new ink collector that uses the group box handle myInkCollector = new InkCollector(gbInkArea.Handle); // Turn the ink collector on myInkCollector.Enabled = true;
} /// <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: // // using (RecognizerContext myRecoContext = new RecognizerContext()) // { // 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(); } } } } }
文件名称是inkrecognition(试试能搜到不)。
以下为原始内容:// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// File: InkRecognition.cs
// Simple Ink Recognition Sample Application
//
// This program demonstrates how one can build a basic handwriting
// recognition application using Microsoft Tablet PC Automation API.
// It first creates an InkCollector object to enable inking
// in the window. Upon receiving the "Recognize!" command, fired
// from the application's button, ToString() is invoked on the
// collected ink strokes to retrieve the best match using the
// default recognizer. The results are presented in a message box.
//
// The features used are: InkCollector, Ink, Strokes,
// RecognizerContext, and RecognizerResult
//
//--------------------------------------------------------------------------using System;
using System.Drawing;
using System.Windows.Forms;// The Ink namespace, which contains the Tablet PC Platform API
using Microsoft.Ink;namespace Microsoft.Samples.TabletPC.InkRecognition
{
/// <summary>
/// The InkRecognition Sample Application form class
/// </summary>
public class InkRecognition : System.Windows.Forms.Form
{
// Declare the Ink Collector object
private InkCollector myInkCollector = null; // myRecognizers is used to retrieve the number of installed recognizers
Recognizers myRecognizers; #region Standard Template Code
private System.Windows.Forms.GroupBox gbInkArea;
private System.Windows.Forms.Button btnRecognize;
private System.Windows.Forms.TextBox txtResults;
private System.ComponentModel.Container components = null;
#endregion /// <summary>
/// Initialize the form and ink collector
/// </summary>
public InkRecognition()
{
#region Standard Template Code
//
// Required for Windows Form Designer support
//
InitializeComponent();
#endregion
} #region Standard Template Code
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
if (myInkCollector != null)
{
myInkCollector.Dispose();
}
}
base.Dispose( disposing );
}
#endregion #region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.gbInkArea = new System.Windows.Forms.GroupBox();
this.btnRecognize = new System.Windows.Forms.Button();
this.txtResults = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// gbInkArea
//
this.gbInkArea.Location = new System.Drawing.Point(8, 0);
this.gbInkArea.Name = "gbInkArea";
this.gbInkArea.Size = new System.Drawing.Size(280, 136);
this.gbInkArea.TabIndex = 0;
this.gbInkArea.TabStop = false;
this.gbInkArea.Text = "Ink Here";
//
// btnRecognize
//
this.btnRecognize.Location = new System.Drawing.Point(8, 144);
this.btnRecognize.Name = "btnRecognize";
this.btnRecognize.Size = new System.Drawing.Size(280, 23);
this.btnRecognize.TabIndex = 1;
this.btnRecognize.Text = "Recognize Ink";
this.btnRecognize.Click += new System.EventHandler(this.btnRecognize_Click);
//
// txtResults
//
this.txtResults.BackColor = System.Drawing.SystemColors.Window;
this.txtResults.ForeColor = System.Drawing.SystemColors.WindowText;
this.txtResults.Location = new System.Drawing.Point(8, 176);
this.txtResults.Name = "txtResults";
this.txtResults.ReadOnly = true;
this.txtResults.Size = new System.Drawing.Size(280, 20);
this.txtResults.TabIndex = 2;
this.txtResults.Text = "";
//
// InkRecognition
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 206);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.txtResults,
this.btnRecognize,
this.gbInkArea});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "InkRecognition";
this.Text = "Ink Recognition Sample";
this.Load += new System.EventHandler(this.InkRecognition_Load);
this.ResumeLayout(false); }
#endregion #region Standard Template Code
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new InkRecognition());
}
#endregion /// <summary>
/// Event Handler from Form Load Event
/// Setup the ink collector for collection
/// </summary>
/// <param name="sender">The control that raised the event.</param>
/// <param name="e">The event arguments.</param>
private void InkRecognition_Load(object sender, System.EventArgs e)
{
// Create the recognizers collection
myRecognizers = new Recognizers(); // Create a new ink collector that uses the group box handle
myInkCollector = new InkCollector(gbInkArea.Handle); // Turn the ink collector on
myInkCollector.Enabled = true;
} /// <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:
//
// using (RecognizerContext myRecoContext = new RecognizerContext())
// {
// 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();
}
}
}
}
}
//IAWinFX.dll、IACore.dll 和 IALoader.dll(这些内容可以在 \Program Files\Reference Assemblies\Microsoft\Tablet PC\v1.7 中找到)的引用。5楼的方法是winform下的。
已上传http://download.csdn.net/detail/slowhand/4402438这里有个wpf下很好用的,dll文件在项目里,识别率蛮高的。
https://skydrive.live.com/?cid=51b2fdd068799d15&sc=documents&id=51B2FDD068799D15%21686
(下载地址在右上角)
AnalysisStatus status = theInkAnalyzer.Analyze();
status.Successful总是false,什么原因,还在查
MSDN上有这几句“此示例要求在系统上安装手写识别器。”
"添加对 WPF 墨迹分析程序集、IAWinFX.dll、IACore.dll 和 IALoader.dll(这些内容可以在 \Program Files\Reference Assemblies\Microsoft\Tablet PC\v1.7 中找到)的引用。"
我的系统上有没有手写识别器我不清楚(是不是xp自带识别器?反正我没装过)
但是“\Program Files\Reference Assemblies\Microsoft\Tablet PC\v1.7”这里面没有IALoader.dll,IAWinFX.dll和IACore.dll都有
是不是这个问题导致我总是识别失败
1、Windows7系统: 正常
2、Windows Embedded Standard系统:
我设置为英文可以,但是设置为中文就识别不了,
我遇到的问题和你一样 我的系统是Windows Embedded Standard 楼主求答案!
1、Windows7系统: 正常
2、Windows Embedded Standard系统:
我设置为英文可以,但是设置为中文就识别不了,
我遇到的问题和你一样 我的系统是Windows Embedded Standard 楼主求答案!
win7自带tabletPC,windowsXp需要下一个tabletPC,里面有demo,可以看下 识别率还是挺高的
1、Windows7系统: 正常
2、Windows Embedded Standard系统:
我设置为英文可以,但是设置为中文就识别不了,
我遇到的问题和你一样 我的系统是Windows Embedded Standard 楼主求答案!
win7自带tabletPC,windowsXp需要下一个tabletPC,里面有demo,可以看下 识别率还是挺高的
谢谢啊
我是Windows Embedded Standard系统缺少语言组件