TabletPC Development Gotchas Part2: Deploying InkPicture applications to Windows XP desktops

If you are developing applications that use an InkPicture control and you plan to deploy your product to customers running Windows XP desktop OS (i.e. not the Windows XP Tablet PC Edition), please read on:

The TabletPC controls (InkPicture and InkEdit) have been designed for being used on Windows XP TabletPC Edition. On other pre-Vista operating systems (Windows 2000, Windows 2003 and non-Tablet PC editions of Windows XP) you can instantiate these controls but can't use them for ink input. This is documented on MSDN.

So far so good. Now, the confusing part is that ink input in those controls is actually enabled on desktop computers for 'development and testing purposes'. The control determines whether you are 'developing and testing' by checking for the presence of the Tablet PC SDK on the machine at runtime. So, if you didn't read the fine print on MSDN and you do all your testing on development machines that happen to have the Tablet PC SDK installed, you will not notice this limitation until a consumer actually installs the application on a desktop computer without SDK.

Fortunately, this limitation has been removed in Windows Vista. The InkPicture control will collect ink on all Windows Vista SKUs and hardware configurations. Moreover, there also is a solution for deploying to Windows XP desktops. The following two facts are key here:

1) the downlevel deployment limitation does not apply to the InkOverlay component

2) attaching an InkOverlay to a PictureBox controls provides feature parity to InkPicture

 

So you can go ahead and build your own InkPicture control by extending the PictureBox control with an InkOverlay. Now it is deployable to non-Tablet PC, pre-Vista operating systems.

Be sure to expose the InkOverlay methods, properties and events to the consumer of your control. My simple example below does this by making the entire InkOverlay a public property. You can do it more elegantly by exposing each relevant method, property and event individually on the control level - and then basically call through to the inner InkOverlay component.

class MyInkPicture : PictureBox

{

    private InkOverlay _inkOverlay;

    public MyInkPicture()

    {

        _inkOverlay = new InkOverlay(this);

        _inkOverlay.Enabled = true;

    }

    public InkOverlay InkOverlay

    {

        get { return _inkOverlay; }

    }

}

Next post in this series: TabletPC Development Gotchas Part3: Coerce to Factoid (XP vs. Vista)

Previous post in this series: TabletPC Development Gotchas Part1: Handling exceptions in Winforms Ink events