| ||
|
To be more productive when building these Pocket PC applications, you would probably use SDP (Smart Device Programmability) and .NET CF (Compact Framework) included in Visual Studio .NET 2003. IntelliProg RichInk Control An efficient way to enable your applications to accept handwritten/drawn text and sound is provided by the RichInk Control from IntelliProg Inc. Actually, this is not a custom control written from scratch, but a wrapper for the RichInk control already available in the Windows CE operating system. That doesn't make it less interesting. On the contrary, with a footprint of about 60 KB it's the most efficient way of utilizing the resources already available. The control includes most of the features available in the native control and it even includes support for a number of events generated by the control. Events are important to create dynamic applications and as you will see the implementation is made in a way a .NET CF developer is used to. Feedback Anyplace Sample In one of our sample projects, Feedback Anyplace, we have used the RichInk control to enable a quality inspector to enter rich data to complement a quality issue report. The application includes the following form: ![]() RichInk Control sample As you can see in the figure, the RichInk control enable the quality inspector to make a drawing and enter handwritten text. The speaker symbol in the upper left corner of the control indicates that a voice recording is attached and by tapping the speaker, the recording is played back. The bottom toolbar can be used to control the recording (make new recordings, stop playback, and so on). It all works much like the Pocket PC Notes application. A detail is that the Tools menu includes a Recognize option that will convert any handwritten input to text. Let's see how to use the RichInk control by having a closer look at the sample code. Code Walkthrough As the control includes a designer, all you need to do to use the RichInk control is to set a reference to it and use the toolbox to draw it on your form. The designer will generate the necessary code for you. The declaration of the control that the designer adds looks like this (in VB.NET): Friend WithEvents rchInk As Intelliprog.Windows.Forms.RichInkAnd to simplify the use of the control, you could add the namespace with the following line of code at the beginning of the form: Imports Intelliprog.Windows.FormsThe control is created by: Me.rchInk = New Intelliprog.Windows.Forms.RichInkAnd in the sample, the designer has created the following initialization code (simplified by removing the above suggested namespace): Me.rchInk.InkLayer = RichInkLayer.SmartInk Me.rchInk.PageStyle = RichInkPageStyle.GridLines Me.rchInk.PenMode = RichInkPenMode.Pen Me.rchInk.Size = New System.Drawing.Size(240, 225) Me.rchInk.ViewMode = RichInkViewMode.WritingView Me.rchInk.VoiceBarPosition = VoiceBarPositions.Bottom Me.rchInk.VoiceBarVisible = True Me.rchInk.WrapMode = RichInkWrapMode.WrapToPage Me.rchInk.ZoomLevel = RichInkZoomLevel.ZoomLevel100For the .NET CF developer, there's really nothing exceptional about this. It looks just like it should. As you can see, the control support many useful options and even the most common events (EnabledChanged, GotFocus, KeyDown, KeyPress, KeyUp, LostFocus, ParentChanged, Resize, TextChanged, Validated, and Validating). Now, that's all you need to start using all the control's features. The only additional code needed in the Feedback Anyplace sample is the text recognition in the menu option's Click event:
Private Sub mitToolsRecognize_Click( _
ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles mitToolsRecognize.Click
rchInk.Recognize()
End Sub
Couldn't be much simpler, but let's have a look at some of the code from the sample included with the
control. An interesting feature is the ability to save the content of the RichInk control to a file,
and it can be done like this (in C#):
rchInk.SaveFile("filename.pwi", RichInkStreamType.RichInk);
Here the file is saved using the Pocket Word format (.pwi), and the RichInkStreamType enum include
the available formats (the other are PlainText, RichText, Unicode, and UnicodeText). A similar format
is used to load data into the RichInk control from a file:
rchInk.LoadFile("filename.pwi", RichInkStreamType.RichInk);
To implement the Edit menu, you simply need to respond to the menu options with the supported methods:
rchInk.Undo(); rchInk.Cut(); rchInk.Copy(); rchInk.Paste(); rchInk.Clear(); rchInk.ClearAll(); rchInk.SelectAll();There are loads of other interesting features like the ability to insert hyperlinks (InsertLink method) and change attributes of selections (like the SelectionColor and SelectionFont methods). You simply have to get the trial and start exploring right away! For more complete examples, see the Feedback Anyplace source code and the sample that comes with the control. Conclusion A challenge when writing successful mobile applications is to provide an efficient way to enter data. If that data entry can be done using drawings, handwritten text, or even recorded sound, chances are that your users can be more productive. With the RichInk control you have a tool that can make it happen, and who know, you might even get rich doing it. Any comments? |
||||||||||||||||||||||||||
| ©2001-2009 Christian Forsberg & Andreas Sjöström |
||