DrawRectangle Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Draws a rectangle on the display device.

Namespace:  Microsoft.SPOT
Assembly:  Microsoft.SPOT.Graphics (in Microsoft.SPOT.Graphics.dll)

public void DrawRectangle(
	Color colorOutline,
	int thicknessOutline,
	int x,
	int y,
	int width,
	int height,
	int xCornerRadius,
	int yCornerRadius,
	Color colorGradientStart,
	int xGradientStart,
	int yGradientStart,
	Color colorGradientEnd,
	int xGradientEnd,
	int yGradientEnd,
	ushort opacity
)

Parameters

colorOutline
Type: Microsoft.SPOT.Presentation.Media..::..Color
The color of the rectangle's outline.
thicknessOutline
Type: System..::..Int32
The thickness of the rectangle's outline, in pixels.
x
Type: System..::..Int32
The x-coordinate of the rectangle's upper-left corner.
y
Type: System..::..Int32
The y-coordinate of the rectangle's upper-left corner.
width
Type: System..::..Int32
The width of the rectangle, in pixels.
height
Type: System..::..Int32
The height of the rectangle, in pixels.
xCornerRadius
Type: System..::..Int32
The x-coordinate value of the corner radius used to produce rounded corners on the rectangle.
yCornerRadius
Type: System..::..Int32
The y-coordinate value of the corner radius used to produce rounded corners on the rectangle.
colorGradientStart
Type: Microsoft.SPOT.Presentation.Media..::..Color
The starting color for a color gradient.
xGradientStart
Type: System..::..Int32
Holds the x coordinate of the starting location of the color gradient.
yGradientStart
Type: System..::..Int32
Holds the y coordinate of the starting location of the color gradient.
colorGradientEnd
Type: Microsoft.SPOT.Presentation.Media..::..Color
Specifies the ending color of the color gradient.
xGradientEnd
Type: System..::..Int32
Holds the x coordinate of the ending location of the color gradient.
yGradientEnd
Type: System..::..Int32
Holds the y coordinate of the ending location of the color gradient.
opacity
Type: System..::..UInt16
Specifies the opacity of the fill color. Set to 0x00 for completely transparent. Set to 0xFF for completely opague.

If a bitmap is embedded as a resource, and its BitmapImageType is Bmp, then the Bitmap object is read-only, and attempts to modify it will throw an exception. You must make a copy of it using Bitmap.DrawImage, and modify the copy, as shown in the following code:

Bitmap bmpMyBitmap = Resources.GetBitmap(Resources.BitmapResources.MyBitmap);
      Bitmap bmpCopy = new Bitmap(bmpMyBitmap.Width, bmpMyBitmap.Height);
      // copy the bitmap
      bmpCopy.DrawImage(0, 0, bmpMyBitmap, 0, 0, bmpMyBitmap.Width, bmpMyBitmap.Height);
      // now you may modify the copy using any Bitmap method
      bmpCopy.MakeTransparent(Microsoft.SPOT.Presentation.Media.Color.White);

The .NET Micro Framework provides the Microsoft.SPOT.Bitmap class for lower-level access, such as animation. For displaying static bitmaps and hyperlinked bitmaps, use the Image control.

Show: