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
類型:BitmapBitmap繪製到。
備註
如果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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.VisualBasic.PowerPacks 命名空間
其他資源
Line 和 Shape 控制項簡介 (Visual Studio)