次の方法で共有


SimpleShape.DrawToBitmap メソッド

指定したビットマップへのレンダリングをサポートします。

名前空間:  Microsoft.VisualBasic.PowerPacks
アセンブリ:  Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)

構文

'宣言
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
)

パラメーター

  • bitmap
    型 : Bitmap

    Bitmapに描画します。

解説

場合、xまたはy座標またはwidthまたはheightのパラメーターtargetBoundsが 0 の場合よりも少ない、ArgumentExceptionがスローされます。

次の例で使用する方法、DrawToBitmapメソッド、ClientRectangleプロパティを描画する、OvalShapeで、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;
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

SimpleShape クラス

Microsoft.VisualBasic.PowerPacks 名前空間

その他の技術情報

ライン コントロールとシェイプ コントロールの概要 (Visual Studio)

方法 : LineShape コントロールを使用して線を描画する (Visual Studio)

方法 : OvalShape コントロールおよび RectangleShape コントロールを使用して図形を描画する (Visual Studio)