Now I have my new Windows Mobile 6.1 device I’ve decided to delve once more into the mysterious realm of developing for mobile devices. My previous forays have both been very lightweight. The most recent was simply displaying bus timetable information within a ListView control. Despite its simplicity its actually something I find very useful on my daily commute – rather than digging around in my bag for the paper version and then tuning in to the times and stops that I’m interested in.
Here’s a screenshot of my original Bus Timetable applet (its just too trivial to be awarded the title “application”):
Now here’s a screenshot of the same application running on my new HTC device:
Hmm.. some things scaled and some didn’t But overall when compared to the other default applications (particularly those written by HTC) it looks pretty lame.
So, I decided to get to work and create a user interface that:
- Scales well across the more common Windows Mobile devices resolutions (at least 240×320, 480×640 and 480×800).
- Fits with the “look and feel” of the pre-installed HTC applications.
- Works with touch only – this type of application needs to work using just my thumb since common scenarios for its use are when I’m walking through a crowd and carrying a bag.
With the help of the UIFramework from MSDN I managed to get some screens that I was pretty happy with. The icons and selection had gradient fills and the icons were superimposed on their corresponding “frames” with a transparent background.
However, I soon found that things weren’t quite a rosy as I was hoping. To start with the UIFramework library sample seems to be a “work in progress”. That is to say it has a lot of bugs or parts that simply don’t work – its obviously intended as a starting reference for someone intending to owner draw their own controls/graphic elements.
Also, I originally created each ButtonBar as a user control. As with WinForms this meant that when it came to scrolling the buttons it looked terrible. Really slow – and each button is its own Window hence there is no capability of double-buffering. Man – I have been so spoiled by WPF – I had long forgotten all this pain! This trick then seemed to be to ditch using controls and just render the entire UI on a single user control. That way the main user control can double buffer all the rendering and there is only one render pass. The downside of course is that you then have to take care of everything – drawing all your own controls, hit testing, anchoring, dpi scaling etc.
Well – I’m not sure where I’m going with all this. But I did consider porting my WinForms Transitions code to the Windows CF. Even this was a no-go though – because although it contains plenty of base classes and helper methods for transforming and hit testing objects it relies heavily on using GraphicsContainer to do the actual transforms. These aren’t supported by the Compact Framework. So, I started from scratch, building a simple graphics library that will let me scale, rotate and translate graphic primitives. So far I have a spinning/zoomable rectangle – guess you gotta start somewhere.