--- title: "How to: Create a Bitmap at Run Time" description: Learn how to create a bitmap object and display it in an existing Windows Forms PictureBox control. ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "bitmaps [Windows Forms], creating" - "bitmaps [Windows Forms], examples [Visual Basic]" ms.assetid: 737bae30-e599-4e1d-bf30-bab8280b32be --- # How to: Create a Bitmap at Run Time This example creates and draws in a object and displays it in an existing Windows Forms control. ## Example [!code-csharp[System.Drawing.CreateBitmapAtRuntime#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Drawing.CreateBitmapAtRuntime/CS/Form1.cs#1)] [!code-vb[System.Drawing.CreateBitmapAtRuntime#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Drawing.CreateBitmapAtRuntime/VB/Form1.vb#1)] ## Compiling the Code This example requires: - A Windows Form that imports the System, System.Drawing and System.Windows.Forms assemblies. ## See also - - [Images, Bitmaps, and Metafiles](images-bitmaps-and-metafiles.md)