共用方式為


Renderer.Draw 方法 (Bitmap, Strokes)

在指定的 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
)

參數

範例

在這個範例中,會將來自與 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

請參閱

參考

Renderer 類別

Renderer 成員

Draw 多載

Microsoft.Ink 命名空間