I was quite surprised to learn that apparently I have missed an important new feature of Windows Mobile 6 (Professional)- inking and ink serialization support. Gone are the days when a developer had to tinker with oh-so-temperamental InkX control. Now everyone and his brother can take advantage not only of high-quality precision ink support with smoothing and serialization, but also of handwriting recognition built into Windows Mobile 6 Professional. To quote the documentation - "It provides a rich inking experience, through high quality curve–fitted ink with anti-aliasing, transparent ink, and highlighter ink. It provides an API for Ink collection, data management, rendering, and recognition. It also provides Ink controls to support the note–taking scenario."
Another important feature is interoperability and serialized data format compatibility with ink support on Tablet PC.
While all of this is nice, there is slight bit of bad news - using this rich set of goodies requires C++. There are 2 ways to use ink in Windows Mobile 6 - InkCanvas control and an COM automation library. InkCanvas control offers the ability to use a regular Win32 control (similar to InkX) to write, highlight, collect ink etc via a set of Windows messages. COM automation library on the other hand allows accessing the entire set of features offered by WISP. And there is no managed wrapper for the time being.
As a public service, we at OpenNETCF.com are proud to offer WISPLite managed wrapper. The wrapper offers the entire WISPLite functionality (although not every method of every interface has been tested). There is InkControl class, which wraps InkCanvas, and a OpenNETCF.WindowsMobile.Ink namespace that contains imported COM interfaces. Some of the interfaces do not wrap cleanly, so a bit of coding is needed.
Here is what the demo app looks like (warning, before running it, change line 132 in Form1.cs to be
inkControl1.SetPenStyle((float)trackBar1.Value, penColor, penType); )
Saving ink data to a file:
using (SaveFileDialog fd = new SaveFileDialog())
fd.Filter = "Ink files (*.isf)|*.isf|All files (*.*)|*.*";
if (fd.ShowDialog() == DialogResult.OK)
byte data = (byte)inkControl1.GetInkData(IC_INKENCODING.BINARY);
FileStream stm = File.OpenWrite(fd.FileName);
stm.Write(data, 0, data.Length);
Getting ink as bitmap and retrieving recongnition result:
pbPreview.Image = inkControl1.GetInkDataAsBitmap();
lblReco.Text = inkControl1.RecognizedText;
In conclusion I'd like to ask to report problems with this wrapper to this blog's comments.