Sdílet prostřednictvím


SimpleShape.DrawToBitmap-Methode

Aktualisiert: November 2007

Unterstützt das Rendering für die angegebene Bitmap.

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

Syntax

'Declaration
Public Overrides Sub DrawToBitmap ( _
    bitmap As Bitmap, _
    targetBounds As Rectangle _
)
'Usage
Dim instance As SimpleShape
Dim bitmap As Bitmap
Dim targetBounds As Rectangle

instance.DrawToBitmap(bitmap, targetBounds)
public override void DrawToBitmap(
    Bitmap bitmap,
    Rectangle targetBounds
)
public:
virtual void DrawToBitmap(
    Bitmap^ bitmap, 
    Rectangle targetBounds
) override
public override function DrawToBitmap(
    bitmap : Bitmap, 
    targetBounds : Rectangle
)

Parameter

Hinweise

Wenn die x-Koordinate oder y-Koordinate bzw. die Parameter width oder height von targetBounds kleiner als 0 (null) sind, wird ArgumentException ausgelöst.

Beispiele

Im folgenden Beispiel wird die Verwendung der DrawToBitmap-Methode und der ClientRectangle-Eigenschaft zum Zeichnen eines OvalShape-Steuerlements auf einem PictureBox-Steuerelement veranschaulicht.

Private Sub Form1_Load(ByVal sender As System.Object, _
 ByVal e As System.EventArgs) Handles MyBase.Load
    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
End Sub
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;
}

Berechtigungen

Siehe auch

Referenz

SimpleShape-Klasse

SimpleShape-Member

Microsoft.VisualBasic.PowerPacks-Namespace

Weitere Ressourcen

Einführung in das Line-Steuerelement und das Shape-Steuerelement (Visual Studio)

Gewusst wie: Zeichnen von Linien mit dem LineShape-Steuerelement (Visual Studio)

Gewusst wie: Zeichnen von Formen mit dem OvalShape-Steuerelement und dem RectangleShape-Steuerelement (Visual Studio)