Share via


SetClippingRectangle Method

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

Sets the clipping region (clipping rectangle) of a bitmap with a specified coordinate pair (x,y), width, and height.

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

Syntax

'Declaration
Public Sub SetClippingRectangle ( _
    x As Integer, _
    y As Integer, _
    width As Integer, _
    height As Integer _
)
public void SetClippingRectangle(
    int x,
    int y,
    int width,
    int height
)
public:
void SetClippingRectangle(
    int x, 
    int y, 
    int width, 
    int height
)
member SetClippingRectangle : 
        x:int * 
        y:int * 
        width:int * 
        height:int -> unit 
public function SetClippingRectangle(
    x : int, 
    y : int, 
    width : int, 
    height : int
)

Parameters

Remarks

Setting the parameters of this method to negative values 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

Microsoft.SPOT Namespace