次の方法で共有


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

指定した BitmapStroke を描画します。

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