DrawImage Method (Int32, Int32, Bitmap, Int32, Int32, Int32, Int32)

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

Draws a rectangular block of pixels on the display device.

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

Syntax

'Declaration
Public Sub DrawImage ( _
    xDst As Integer, _
    yDst As Integer, _
    bitmap As Bitmap, _
    xSrc As Integer, _
    ySrc As Integer, _
    width As Integer, _
    height As Integer _
)
public void DrawImage(
    int xDst,
    int yDst,
    Bitmap bitmap,
    int xSrc,
    int ySrc,
    int width,
    int height
)
public:
void DrawImage(
    int xDst, 
    int yDst, 
    Bitmap^ bitmap, 
    int xSrc, 
    int ySrc, 
    int width, 
    int height
)
member DrawImage : 
        xDst:int * 
        yDst:int * 
        bitmap:Bitmap * 
        xSrc:int * 
        ySrc:int * 
        width:int * 
        height:int -> unit 
public function DrawImage(
    xDst : int, 
    yDst : int, 
    bitmap : Bitmap, 
    xSrc : int, 
    ySrc : int, 
    width : int, 
    height : int
)

Parameters

  • xDst
    Type: System. . :: . .Int32
    The x-coordinate location of the upper-left corner of the rectangular area on the display to which the specified pixels are to be copied.
  • yDst
    Type: System. . :: . .Int32
    The y-coordinate location of the upper-left corner of the rectangular area on the display to which the specified pixels are to be copied.
  • xSrc
    Type: System. . :: . .Int32
    The x-coordinate location of the upper-left corner of the rectangular area in the source bitmap from which the specified pixels are to be copied.
  • ySrc
    Type: System. . :: . .Int32
    The y-coordinate location of the upper-left corner of the rectangular area in the source bitmap from which the specified pixels are to be copied.

Remarks

Passing negative values in the xSrc and ySrc parameters produces undefined results.

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.

.NET Framework Security

See Also

Reference

Bitmap Class

DrawImage Overload

Microsoft.SPOT Namespace