共用方式為


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 命名空間