Renderer.Draw メソッド (Graphics, Strokes)
指定した Graphics サーフェイスで Strokes コレクションを描画します。
名前空間 : Microsoft.Ink
アセンブリ : Microsoft.Ink (Microsoft.Ink.dll 内)
構文
'宣言
Public Sub Draw ( _
g As Graphics, _
strokes As Strokes _
)
'使用
Dim instance As Renderer
Dim g As Graphics
Dim strokes As Strokes
instance.Draw(g, strokes)
public void Draw(
Graphics g,
Strokes strokes
)
public:
void Draw(
Graphics^ g,
Strokes^ strokes
)
public void Draw(
Graphics g,
Strokes strokes
)
public function Draw(
g : Graphics,
strokes : Strokes
)
パラメータ
- g
型 : System.Drawing.Graphics
描画に使用する Graphics オブジェクト。
- strokes
型 : Microsoft.Ink.Strokes
描画する Strokes コレクション。
解説
メモ : |
---|
可能な場合は必ず、IntPtr を受け入れるオーバーロードではなく、Graphics オブジェクトを受け入れる適切なオーバーロードを使用します。 |
ペンの幅は、SetViewTransform メソッドをどのように使用するかに基づいて適切に調整されます。具体的には、ペンの幅がビュー変換の行列式の平方根で乗算 (またはスケーリング) されます。
メモ : |
---|
ペンの幅を明示的に設定していない場合は、既定値の 53 になります。正しい境界ボックスを生成するには、ペンの幅を行列式の平方根で乗算する必要があります。境界ボックスの高さと幅はそれぞれ、この計算結果値の 1/2 だけ拡大されます。 |
たとえば、ペンの幅が 53 で行列式の平方根が 50、境界ボックスが (0,0,1000,1000) であるとします。ペンの幅は (53 * 50) / 2 の計算結果に従って、境界ボックスの各方向に対して調整され、右側と下側は 1 ずつ増分されます。この結果、(-1325,-1325, 2326, 2326) の境界ボックスが描画されます。
Renderer オブジェクトは、ビューポートとウィンドウの原点を強制的に 0,0 にします。既存の設定は保存されて復元されますが、Renderer によっては使用されません。スクロールを実行するには、Renderer オブジェクトの GetViewTransform メソッドおよび GetObjectTransform メソッドを使用します。
例
この例では、InkOverlay オブジェクトに関連付けられた Ink オブジェクトの Strokes コレクション全体が、InkOverlay オブジェクト自身に関連付けられたオブジェクト上にではなく、Panel 上に表示されます。これは、Draw メソッドを呼び出し、g パラメータに、InkOverlay オブジェクトに関連付けられているものとは異なる Graphics オブジェクトを渡すことによって実現されます。
' 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
' get a graphics object for another panel
Using g As Graphics = Me.panelForDraw.CreateGraphics()
' get a Renderer object. We could have used
' mInkOverlay.Renderer, this is another way
Dim R As Renderer = New Renderer()
' draw the strokes
R.Draw(g, allStrokes)
End Using
End Using
// 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)
{
// get a graphics object for another panel
using (Graphics g = this.panelForDraw.CreateGraphics())
{
// get a Renderer object. We could have used
// mInkOverlay.Renderer, this is another way
Renderer R = new Renderer();
// draw the strokes
R.Draw(g, allStrokes);
}
}
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0