SimpleShape.DrawToBitmap (Método)
Permite la representación del mapa de bits especificado.
Espacio de nombres: Microsoft.VisualBasic.PowerPacks
Ensamblado: Microsoft.VisualBasic.PowerPacks.Vs (en Microsoft.VisualBasic.PowerPacks.Vs.dll)
Sintaxis
'Declaración
Public Overrides Sub DrawToBitmap ( _
bitmap As Bitmap, _
targetBounds As Rectangle _
)
public override void DrawToBitmap(
Bitmap bitmap,
Rectangle targetBounds
)
public:
virtual void DrawToBitmap(
Bitmap^ bitmap,
Rectangle targetBounds
) override
abstract DrawToBitmap :
bitmap:Bitmap *
targetBounds:Rectangle -> unit
override DrawToBitmap :
bitmap:Bitmap *
targetBounds:Rectangle -> unit
public override function DrawToBitmap(
bitmap : Bitmap,
targetBounds : Rectangle
)
Parámetros
- bitmap
Tipo: System.Drawing.Bitmap
Bitmap que se va a dibujar en.
- targetBounds
Tipo: System.Drawing.Rectangle
Rectangle dentro de las que se genera LineShape .
Comentarios
Si son las coordenadas de x o de y o los parámetros de width o de height de targetBounds menor que 0, se produce ArgumentException .
Ejemplos
El ejemplo siguiente muestra cómo utilizar el método de DrawToBitmap y la propiedad de ClientRectangle para dibujar OvalShape en un control de PictureBox .
Private Sub Form1_Load() 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;
}
Seguridad de .NET Framework
- Plena confianza para el llamador inmediato. Un código de confianza parcial no puede utilizar este miembro. Para obtener más información, vea Utilizar bibliotecas de código que no es de plena confianza.
Vea también
Referencia
Microsoft.VisualBasic.PowerPacks (Espacio de nombres)
Otros recursos
Introducción a los controles de líneas y formas (Visual Studio)
Cómo: Dibujar líneas con el control LineShape (Visual Studio)
Cómo: Dibujar formas con los controles OvalShape y RectangleShape (Visual Studio)