Displaying Images

The Image component allows the display of images. It has a single property, the image we want to draw, which the component holds as a bitmap.

Bitmap b = Resources.GetBitmap(Resources.BitmapResources.Background);
Image i = new Image(b);

This code creates a bitmap and then constructs an image based on it. We can then add the image to a StackPanel or Canvas and use it as part of a display.

Creating a Custom Image—A Meter with a Dial

We can perform further customization of the components, and learn more about how to do this, by creating an image with an additional component on top. The aim of the class MeterDialPanel is to draw an indicator needle on a background graphic to allow a device to display a dial.

Figure 7-17 shows how we can ...

Get Embedded Programming with the Microsoft® .NET Micro Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.