
C# Microsoft.Ink 手写识别源代码参考http://www.cnblogs.com/geovindu/p/3702427.html,里面介绍的很详细,而且微软官方给的资料很详细,但是唯一没给出怎么设置写字宽度和写字时候的颜色,这里我把方法分享给大家,注意此方法我已经测试过,确实可用,请在窗口加载时候修改如下代码
private void Form1_Load(object sender, EventArgs e) { //this.rct.RecognitionWithAlternates += new RecognizerContextRecognitionWithAlternatesEventHandler(rct_RecognitionWithAlternates); ic = new InkCollector(ink_here.Handle); this.ic.Stroke += new InkCollectorStrokeEventHandler(ic_Stroke); DrawingAttributes da = new DrawingAttributes();//增加代码 da.Width = 100f;//这里设置写字宽度,da.Color可以设置颜色,这里不再给出颜色,直接设置da.Color即可 ic.DefaultDrawingAttributes = da; ic.Enabled = true; ink_(); // this.ic.Stroke += new InkCollectorStrokeEventHandler(ic_Stroke); this.rct.RecognitionWithAlternates += new RecognizerContextRecognitionWithAlternatesEventHandler(rct_RecognitionWithAlternates); rct.Strokes = ic.Ink.Strokes; }