Bitmap Constructor (String, Boolean)


Initializes a new instance of the Bitmap class from the specified file.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

new : 
        filename:string *
        useIcm:bool -> Bitmap


Type: System.String

The name of the bitmap file.

Type: System.Boolean

true to use color correction for this Bitmap; otherwise, false.

Use this constructor to open images with the following file formats: BMP, GIF, EXIF, JPG, PNG and TIFF. For more information about supported formats, see Types of Bitmaps. The file remains locked until the Bitmap is disposed.

The following code example demonstrates how to construct a new bitmap from a file. The example uses the GetPixel and SetPixel methods to recolor the image. It also uses the PixelFormat property.

This example is designed to be used with a Windows Form that contains a Label, PictureBox and Button named Label1, PictureBox1 and Button1, respectively. Paste the code into the form and associate the Button1_Click method with the button's Click event.

No code example is currently available or this language may not be supported.


for calling into unmanaged code. Related enumeration: UnmanagedCode

.NET Framework
Available since 1.1
Return to top