Renderer.Draw 方法 (Bitmap, Strokes)
命名空间: Microsoft.Ink
程序集: Microsoft.Ink(在 Microsoft.Ink.dll 中)
语法
声明
Public Sub Draw ( _
destinationBitmap As Bitmap, _
strokes As Strokes _
)
用法
Dim instance As Renderer
Dim destinationBitmap As Bitmap
Dim strokes As Strokes
instance.Draw(destinationBitmap, strokes)
public void Draw(
Bitmap destinationBitmap,
Strokes strokes
)
public:
void Draw(
Bitmap^ destinationBitmap,
Strokes^ strokes
)
public void Draw(
Bitmap destinationBitmap,
Strokes strokes
)
public function Draw(
destinationBitmap : Bitmap,
strokes : Strokes
)
参数
- destinationBitmap
类型:System.Drawing.Bitmap
要在其上进行绘制的指定 Bitmap。
- strokes
类型:Microsoft.Ink.Strokes
要绘制的 Strokes 集合。
示例
在此示例中,将在已从文件加载的位图图像上绘制与 InkOverlay 对象关联的 Ink 对象中的整个 Strokes 集合。
调用 Draw 方法不会显示图像和笔画。该方法会在准备显示时将笔画呈现数据与位图图像数据合并。通过调用与 Panel 对象关联的 Graphics 对象的 DrawImage 方法,可以使位图图像(现在用笔画呈现数据修改过)可见。
' get the Bitmap object loaded from a file
' scale the image to match the panel size
Dim bgImage As Bitmap = New Bitmap(New Bitmap(imageFileName), Me.panelForDraw.Size)
' place (draw) the stroke collection on the bitmap
' Access to the Ink.Strokes property returns a copy of the Strokes object.
' This copy must be implicitly (via using statement) or explicitly
' disposed of in order to avoid a memory leak.
Using allStrokes As Strokes = mInkOverlay.Ink.Strokes
mInkOverlay.Renderer.Draw(bgImage, allStrokes)
End Using
' now display the bitmap (with the strokes) on the panel
Using g As Graphics = Me.panelForDraw.CreateGraphics()
g.DrawImage(bgImage, 0, 0)
End Using
bgImage.Dispose()
// get the Bitmap object loaded from a file
// scale the image to match the panel size
Bitmap bgImage = new Bitmap(new Bitmap(imageFileName), this.panelForDraw.Size);
// place (draw) the stroke collection on the bitmap
// Access to the Ink.Strokes property returns a copy of the Strokes object.
// This copy must be implicitly (via using statement) or explicitly
// disposed of in order to avoid a memory leak.
using (Strokes allStrokes = mInkOverlay.Ink.Strokes)
{
mInkOverlay.Renderer.Draw(bgImage, allStrokes);
}
// now display the bitmap (with the strokes) on the panel
using (Graphics g = this.panelForDraw.CreateGraphics())
{
g.DrawImage(bgImage,0,0);
}
bgImage.Dispose();
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0