Browse DevX
Sign up for e-mail newsletters from DevX


Creating Tablet PC Applications with VS .NET : Page 2

The Tablet PC platform supports applications with special tablet features enabled, such as ink input and pen-based operation. In order for this platform to become truly popular, third-party vendors will also have to ink-enable their applications. Find out how.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

The Hardware
Some of the biggest differences between regular PCs and Tablet PCs are to be found in the hardware. Microsoft has an entire catalog of criteria that needs to be fulfilled in order for a Tablet PC to be considered a "true" Tablet PC. Many requirements have to do with device sizes, screen resolution, power management, and the like. Many requirements are based on requirements for regular PCs (such as docking and undocking without reboot), and some of the requirements are stricter than those for regular PCs (waking up from sleep mode in a certain amount of time for instance—less than five seconds in this case). Also, there are a number of "shall" requirements, such as device weight and the like. The most important hardware difference between regular PCs and Tablet PCs is the addition of a digitizer. This is the device that senses the position of the pen on the display. Unlike Pocket PC digitizers, the digitizer technology utilized by Tablet PCs is not touch sensitive. This means that scratching the display with your fingernail will not move the mouse pointer around (as it does on Pocket PCs). Instead, the Tablet PC platform utilizes electromagnetic digitizers. The pen emits a weak electromagnetic field that is sensed by the digitizer. This approach has a number of advantages over touch technology. For one, the digitizer can be mounted behind the display, resulting in a clearer and brighter image. Also, the digitizer can sense the pen before it even touches the display. Many digitizers can even sense the angle and rotation of the pen. Some applications that produce three-dimensional images (CAD, for instance) can utilize such information in interesting ways. Many digitizers are also pressure sensitive. This may seem to contradict the fact that the digitizer is not touch sensitive. In fact, pressure information is picked up by the pen. In most Tablet PC applications, the harder you hold the pen down, the thicker the drawn line is (although applications are free to use the pressure information for other purposes).

Developing for Tablet PCs
In order to develop for Tablet PCs, you mainly need the Software Development Kit for Tablet PC Edition 2005 (which you can download for free), as well as a development tool that supports either Win32 APIs (C++), COM (VB6, VFP, etc.), or managed code. (Because this article is about writing Tablet PC applications with Visual Studio .NET, I'll focus on the managed code parts of the SDK.) On top of that, you also need a computer that runs either Windows XP, or Windows XP Tablet PC Edition. That's right: a Tablet PC is not required to develop Tablet PC applications. You can do most development on a regular PC, simulating pen input with the mouse, although this is not really comparable to real pen input. For this reason, I would recommend that if you cannot get a Tablet PC, try to at least get a digitizer pad for your regular PC. It is cheaper than a Tablet PC and much better than using the mouse for pen operations. But of course, it is not quite the same as writing on the actual display.

Tablet PCs will benefit all those users who need a full-featured computer, but do not have the luxury to sit down while operating it. One-handed input will be crucial.
If you have a Tablet PC, you have two options: you can develop on the actual Tablet PC, or you can develop on your desktop PC, deploy the application to the Tablet PC, and debug remotely. Although Tablet PCs are regular PCs that can even have external keyboards and monitors hooked up, you will probably only want to do development on Tablet PCs if you have a top-of-the-line model. Right now, I am not aware of P4 Tablet PCs (although I am sure they are just around the corner). My model only has 256MB of RAM (although the best model I am currently aware of supports up to 2GB). This means that the system will have trouble running Visual Studio .NET and possibly even SQL Server and launching a debug session. I am writing this article on a Tablet PC, and I am also writing the sample code on this device. (It works OK as long as I compile in release mode).

The Managed SDK
The Managed SDK provides a number of classes and controls that can be used to implement ink functionality. The controls can be added to your Visual Studio toolbox and dropped on any Windows form. There are two different controls. One is called the InkEdit control. It replaces the regular TextBox control with a control that supports ink either by recognizing whatever a user writes, or by storing the ink as an image. The InkEdit control is derived from the RichTextBox control. This means that the control also supports text with rich formatting.

The Tablet PC API makes handwriting recognition amazingly easy.
The InkEdit control provides a quick way to add ink functionality to your applications. Unfortunately, there are a few issues with this approach. For one, ink-enabled textboxes need to be larger in dimension than regular textboxes to give the user enough room to handwrite text. You'll find that 21 vertical pixels simply isn't enough. The other problem is that the control provides rudimentary quality. Ink recognition works reasonably well (and is the default behavior for all written text), but when the control runs in ink-collection mode (where the ink gets stored as handwriting, rather than actual text), things do not work as well. The rendering quality of the ink is poor. Also, the control tries to match ink dimensions to the point size of the control. This means that ink written 2/3 of an inch tall will be shrunk down to be 8 points tall at its tallest point (assuming that the point size of the control is set to 8pt). You can easily experiment with this control on your own, but in this article, I'll show you how to develop different approaches to ink-enabling applications that work much better than this quick and dirty implementation.

The other control provided by the SDK is the InkPicture control. This control has been designed to load a bitmap as a background image and then perform ink annotations. The InkPicture control is very similar to the InkOverlay class, discussed later in great detail. In general, as a .NET developer you are likely to be more interested in the SDK classes than the controls, as they provide a lot more control over their behavior and are only slightly more time consuming to use. The class that is of most interest is the InkOverlay, providing the most functionality of all the provided classes. (The InkOverlay is very similar to the InkCollector, but with some added functionality such as integrated delete and select capabilities.)

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date