Renderer.Draw 方法 (Bitmap, Stroke)

在指定 Bitmap 上绘制 Stroke

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public Sub Draw ( _
    destinationBitmap As Bitmap, _
    stroke As Stroke _
)
用法
Dim instance As Renderer
Dim destinationBitmap As Bitmap
Dim stroke As Stroke

instance.Draw(destinationBitmap, stroke)
public void Draw(
    Bitmap destinationBitmap,
    Stroke stroke
)
public:
void Draw(
    Bitmap^ destinationBitmap, 
    Stroke^ stroke
)
public void Draw(
    Bitmap destinationBitmap,
    Stroke stroke
)
public function Draw(
    destinationBitmap : Bitmap, 
    stroke : Stroke
)

参数

示例

在此示例中,在 Ink 对象中创建一个 Stroke 对象。笔画 从墨迹区域的左上角延伸到从左上角向右和向下对角 5000 HIMETRIC 单位的点。

笔画 在创建后立即绘制到已从文件加载的位图图像上。调用 Draw 方法不会显示图像和笔画。该方法会在准备显示时将笔画呈现数据与位图图像数据合并。通过调用与 Panel 对象关联的 Graphics 对象的 DrawImage 方法,可以使位图图像(现在用笔画呈现数据修改过)可见。

' create a stroke
Dim strokePoints() As Point = {New Point(0), New Point(5000, 5000)}
Dim oneStroke As Stroke = mInkOverlay.Ink.CreateStroke(strokePoints)
' 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 on the bitmap
mInkOverlay.Renderer.Draw(bgImage, oneStroke)
' now display the bitmap (with the stroke) on the panel
Using g As Graphics = Me.panelForDraw.CreateGraphics()
    g.DrawImage(bgImage, 0, 0)
End Using
bgImage.Dispose()
// create a stroke
Point[] strokePoints = new Point[2] { new Point(0), new Point(5000, 5000) };
Stroke oneStroke = mInkOverlay.Ink.CreateStroke(strokePoints);
// 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 on the bitmap
mInkOverlay.Renderer.Draw(bgImage, oneStroke);
// now display the bitmap (with the stroke) 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

另请参见

参考

Renderer 类

Renderer 成员

Draw 重载

Microsoft.Ink 命名空间