次の方法で共有


Renderer.Draw メソッド (Bitmap, Strokes)

指定した BitmapStrokes コレクションを描画します。

名前空間 :  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 名前空間