ARTICLE

Dynamic Bitmap in VB.NET

Posted by John Arcadella Articles | GDI+ in VB.NET March 21, 2011
How to create a Bitmap at runtime in VB.NET
 
Reader Level:

The following code snippet shows how to create a bitmap at run-time in VB.NET.


Private pictureBox1 As New PictureBox()

 

Public Sub CreateBitmapAtRuntime()

    pictureBox1.Size = New Size(210, 110)

    Me.Controls.Add(pictureBox1)

    Dim dynamicBitmap As New Bitmap(200, 100)

    Dim g As Graphics = Graphics.FromImage(dynamicBitmap )

    Dim red As Integer = 0

    Dim range As Integer = 11

    While range <= 100

        g.FillRectangle(Brushes.Red, 0, red, 200, 10)

        g.FillRectangle(Brushes.White, 0, white, 200, 10)

        red += 20

        range += 20

    End While

    pictureBox1.Image = dynamicBitmap

 

End Sub

 


Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor