Share via


StretchImage Method (Int32, Int32, Int32, Int32, Bitmap, Int32, Int32, Int32, Int32, UInt16)

[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, stretching or shrinking the rectangular area as necessary.

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

Syntax

'Declaration
Public Sub StretchImage ( _
    xDst As Integer, _
    yDst As Integer, _
    widthDst As Integer, _
    heightDst As Integer, _
    bitmap As Bitmap, _
    xSrc As Integer, _
    ySrc As Integer, _
    widthSrc As Integer, _
    heightSrc As Integer, _
    opacity As UShort _
)
public void StretchImage(
    int xDst,
    int yDst,
    int widthDst,
    int heightDst,
    Bitmap bitmap,
    int xSrc,
    int ySrc,
    int widthSrc,
    int heightSrc,
    ushort opacity
)
public:
void StretchImage(
    int xDst, 
    int yDst, 
    int widthDst, 
    int heightDst, 
    Bitmap^ bitmap, 
    int xSrc, 
    int ySrc, 
    int widthSrc, 
    int heightSrc, 
    unsigned short opacity
)
member StretchImage : 
        xDst:int * 
        yDst:int * 
        widthDst:int * 
        heightDst:int * 
        bitmap:Bitmap * 
        xSrc:int * 
        ySrc:int * 
        widthSrc:int * 
        heightSrc:int * 
        opacity:uint16 -> unit 
public function StretchImage(
    xDst : int, 
    yDst : int, 
    widthDst : int, 
    heightDst : int, 
    bitmap : Bitmap, 
    xSrc : int, 
    ySrc : int, 
    widthSrc : int, 
    heightSrc : int, 
    opacity : ushort
)

Parameters

  • xDst
    Type: System. . :: . .Int32
    The x-coordinate of the upper-left corner of the rectangular area to which the pixels are to be copied.
  • yDst
    Type: System. . :: . .Int32
    The y-coordinate of the upper-left corner of the rectangular area to which the pixels are to be copied.
  • widthDst
    Type: System. . :: . .Int32
    The width of the rectangular area on the display to stretch the image.
  • heightDst
    Type: System. . :: . .Int32
    The height of the rectangular area on the display to scale the image.
  • xSrc
    Type: System. . :: . .Int32
    The x-coordinate location of the upper-left corner of the rectangular area in the source bitmap from which to stretch the image.
  • ySrc
    Type: System. . :: . .Int32
    The y-coordinate location of the upper-left corner of the rectangular area in the source bitmap from which to stretch the image.
  • widthSrc
    Type: System. . :: . .Int32
    The width of the rectangular area in the source bitmap from which to stretch the image.
  • heightSrc
    Type: System. . :: . .Int32
    The height of the rectangular area in the source bitmap from which to stretch the image.
  • opacity
    Type: System. . :: . .UInt16
    The bitmap's degree of opacity. A value of 0 (zero) makes the bitmap completely opaque (not transparent at all); a value of 255 makes the bitmap completely transparent.

Remarks

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

StretchImage Overload

Microsoft.SPOT Namespace