private RecognizerContext recognizectx; // REM 识别器上下文 // Private myInkCollector As InkCollector // REM 初始化墨迹识别器 public void InitRecognizer() { myRecognizers = new Recognizers(); strokes = ink.CreateStrokes(); recognizectx = myRecognizers.GetDefaultRecognizer().CreateRecognizerContext(); recognizectx.Strokes = strokes; }
/// <summary> /// Converts a Sketch shape into a collection of Microsoft.Ink strokes. /// </summary> /// <param name="shape">The shape to convert</param> /// <returns>The desired ink strokes</returns> public Microsoft.Ink.Strokes convertToInk(Sketch.Shape shape) { // Create a collection of strokes Microsoft.Ink.Ink ink = new Microsoft.Ink.Ink(); Microsoft.Ink.Strokes inkStrokes = ink.CreateStrokes(); Sketch.Substroke[] sketchStrokes = shape.Substrokes; // Add the substrokes of our format to the strokes collection. foreach (Sketch.Substroke sub in sketchStrokes) { inkStrokes.Add(convertToInk(sub, ink)); } return(inkStrokes); }