Share via


Bitmap.DrawImage Method

Draws a rectangular block of pixels on the display device.

Overload List

Name Description
Bitmap.DrawImage (Int32, Int32, Bitmap, Int32, Int32, Int32, Int32) Draws a rectangular block of pixels on the display device.
Bitmap.DrawImage (Int32, Int32, Bitmap, Int32, Int32, Int32, Int32, UInt16) Draws a rectangular block of pixels with a specified degree of transparency.

Remarks

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 Microsoft.SPOT.Presentation.Controls.Image control.

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);
      

Version Information

Available in .NET Micro Framework version 2.0, 2.5

See Also

Reference

Bitmap Class
Bitmap Members
Microsoft.SPOT Namespace