--- title: "Drawing, Positioning, and Cloning Images in GDI+" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "raster images [Windows Forms]" - "images [Windows Forms], positioning" - "drawing [Windows Forms], images" - "drawing [Windows Forms], raster images" - "images [Windows Forms], cloning" - "images [Windows Forms], drawing" - "GDI+, drawing images" - "GDI+, cloning images" - "GDI+, positioning images" ms.assetid: 09f0c07a-19c0-43b4-90a2-862a10545ce8 --- # Drawing, Positioning, and Cloning Images in GDI+ You can use the class to load and display raster images, and you can use the class to load and display vector images. The and classes inherit from the class. To display a vector image, you need an instance of the class and a . To display a raster image, you need an instance of the class and a . The instance of the class provides the method, which receives the or as an argument. ## File Types and Cloning The following code example shows how to construct a from the file Climber.jpg and displays the bitmap. The destination point for the upper-left corner of the image, (10, 10), is specified in the second and third parameters. [!code-csharp[System.Drawing.ImagesBitmapsMetafiles#11](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Drawing.ImagesBitmapsMetafiles/CS/Class1.cs#11)] [!code-vb[System.Drawing.ImagesBitmapsMetafiles#11](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Drawing.ImagesBitmapsMetafiles/VB/Class1.vb#11)] The following illustration shows the image. ![Image Sample](./media/aboutgdip03-art04.gif "AboutGdip03_Art04") You can construct objects from a variety of graphics file formats: BMP, GIF, JPEG, EXIF, PNG, TIFF, and ICON. The following code example shows how to construct objects from a variety of file types and then displays the bitmaps. [!code-csharp[System.Drawing.ImagesBitmapsMetafiles#12](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Drawing.ImagesBitmapsMetafiles/CS/Class1.cs#12)] [!code-vb[System.Drawing.ImagesBitmapsMetafiles#12](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Drawing.ImagesBitmapsMetafiles/VB/Class1.vb#12)] The class provides a method that you can use to make a copy of an existing . The method has a source rectangle parameter that you can use to specify the portion of the original bitmap that you want to copy. The following code example shows how to create a by cloning the top half of an existing . Then both images are drawn. [!code-csharp[System.Drawing.ImagesBitmapsMetafiles#13](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Drawing.ImagesBitmapsMetafiles/CS/Class1.cs#13)] [!code-vb[System.Drawing.ImagesBitmapsMetafiles#13](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Drawing.ImagesBitmapsMetafiles/VB/Class1.vb#13)] The following illustration shows the two images. ![Cropping](./media/aboutgdip03-art05.gif "AboutGdip03_Art05") ## See also - [Images, Bitmaps, and Metafiles](images-bitmaps-and-metafiles.md) - [How to: Create Graphics Objects for Drawing](how-to-create-graphics-objects-for-drawing.md) - [Working with Images, Bitmaps, Icons, and Metafiles](working-with-images-bitmaps-icons-and-metafiles.md)