Duration (Pacific Standard Time):
To (Pacific Standard Time):
  • None
User Action:
  • None
Visual Basic Power Packs

SimpleShape.DrawToBitmap Method

Supports rendering to the specified bitmap.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks (in Microsoft.VisualBasic.PowerPacks.dll)

Public Overrides Sub DrawToBitmap ( _
	bitmap As Bitmap, _
	targetBounds As Rectangle _
Dim instance As SimpleShape
Dim bitmap As Bitmap
Dim targetBounds As Rectangle

instance.DrawToBitmap(bitmap, targetBounds)


Type: System.Drawing.Bitmap

The Bitmap to be drawn to.

Type: System.Drawing.Rectangle

The Rectangle within which the LineShape is rendered.

If the x or y coordinates or the width or height parameters of targetBounds are less than 0, an ArgumentException is thrown.

The following example demonstrates how to use the DrawToBitmap method and the ClientRectangle property to draw a OvalShape on a PictureBox control.

Dim pic As New System.Drawing.Bitmap(Me.PictureBox1.Image, _
  PictureBox1.Width, PictureBox1.Height)
Dim rect As New System.Drawing.Rectangle
' Assign the client rectangle.
rect = OvalShape1.ClientRectangle
' Draw the oval on the bitmap.
OvalShape1.DrawToBitmap(pic, rect)
PictureBox2.Image = pic