Export (0) Print
Expand All

SimpleShape.DrawToBitmap Method

Supports rendering to the specified bitmap.

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

public override void DrawToBitmap(
	Bitmap bitmap,
	Rectangle targetBounds
)

Parameters

bitmap
Type: System.Drawing.Bitmap

The Bitmap to be drawn to.

targetBounds
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 an OvalShape on a PictureBox control.

private void form1_Load(System.Object sender, System.EventArgs e)
{
    System.Drawing.Bitmap pic = new System.Drawing.Bitmap(this.pictureBox1.Image, 
        pictureBox1.Width, pictureBox1.Height);
    System.Drawing.Rectangle rect = new System.Drawing.Rectangle();
    // Assign the client rectangle.
    rect = ovalShape1.ClientRectangle;
    // Draw the oval on the bitmap.
    ovalShape1.DrawToBitmap(pic, rect);
    pictureBox2.Image = pic;
}

Show:
© 2014 Microsoft