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 ...

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.