O'Reilly logo

Embedded Programming with the Microsoft® .NET Micro Framework by Rob Miles, Donald Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Drawing Shapes

The Bitmap class provides methods that allow you to draw shapes on the display. These provide the ability to achieve some impressive graphical effects, giving a wide range of controls to the drawing process.

Drawing Plain Filled Rectangles

You can start by drawing a simple white rectangle on the display. The method DrawRectangle will do this:

myBitmap.DrawRectangle(
   Colors.White,                               // outline color
   1,                                          // outline thickness
   0, 0,                                       // x, y
   myBitmap.Width, myBitmap.Height,            // width and height
   0, 0,                                       // x and y corner radius
   Colors.White,                               // gradient start color
   0, 0,                                       // gradient start coordinate
   Colors.White,                               // gradient end color
   myBitmap.Width, myBitmap.Height,            // gradient end coordinate
   0xff);                                      // opacity

   myBitmap.Flush();

The DrawRectangle ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required