Shape.DrawToBitmap 方法
支持呈现到指定的位图。
命名空间: Microsoft.VisualBasic.PowerPacks
程序集: Microsoft.VisualBasic.PowerPacks.Vs(在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)
语法
声明
Public MustOverride Sub DrawToBitmap ( _
bitmap As Bitmap, _
targetBounds As Rectangle _
)
public abstract void DrawToBitmap(
Bitmap bitmap,
Rectangle targetBounds
)
public:
virtual void DrawToBitmap(
Bitmap^ bitmap,
Rectangle targetBounds
) abstract
abstract DrawToBitmap :
bitmap:Bitmap *
targetBounds:Rectangle -> unit
public abstract function DrawToBitmap(
bitmap : Bitmap,
targetBounds : Rectangle
)
参数
- bitmap
类型:System.Drawing.Bitmap
要绘制的 Bitmap 。
- targetBounds
类型:System.Drawing.Rectangle
中 LineShape 呈现的 Rectangle 。
备注
如果 X 或 Y 协调或 targetBounds 的 Width 或 Height 参数小于 0, ArgumentException 将引发异常。
示例
下面的示例演示如何使用 DrawToBitmap 方法绘制 LineShape 在 PictureBox 控件之上。
Dim pic As New System.Drawing.Bitmap(Me.PictureBox1.Image,
PictureBox1.Width, PictureBox1.Height)
Dim rect As New System.Drawing.Rectangle(LineShape1.X1,
LineShape1.Y1, LineShape1.X2 - LineShape1.X1,
LineShape1.Y2 - LineShape1.Y1)
LineShape1.DrawToBitmap(pic, rect)
PictureBox2.Image = pic
System.Drawing.Bitmap pic = new System.Drawing.Bitmap(this.pictureBox1.Image,
pictureBox1.Width, pictureBox1.Height);
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(lineShape1.X1,
lineShape1.Y1, lineShape1.X2 - lineShape1.X1, lineShape1.Y2 - lineShape1.Y1);
lineShape1.DrawToBitmap(pic, rect);
pictureBox2.Image = pic;
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。
请参见
参考
Microsoft.VisualBasic.PowerPacks 命名空间
其他资源
如何:使用 LineShape 控件绘制直线 (Visual Studio)