Share via


DynamicRenderer.OnDraw 메서드

정의

잉크를 실시간으로 그리므로 태블릿 펜이나 기타 포인팅 디바이스에서 잉크가 "흘러나오는" 것처럼 표시됩니다.

protected:
 virtual void OnDraw(System::Windows::Media::DrawingContext ^ drawingContext, System::Windows::Input::StylusPointCollection ^ stylusPoints, System::Windows::Media::Geometry ^ geometry, System::Windows::Media::Brush ^ fillBrush);
protected virtual void OnDraw (System.Windows.Media.DrawingContext drawingContext, System.Windows.Input.StylusPointCollection stylusPoints, System.Windows.Media.Geometry geometry, System.Windows.Media.Brush fillBrush);
abstract member OnDraw : System.Windows.Media.DrawingContext * System.Windows.Input.StylusPointCollection * System.Windows.Media.Geometry * System.Windows.Media.Brush -> unit
override this.OnDraw : System.Windows.Media.DrawingContext * System.Windows.Input.StylusPointCollection * System.Windows.Media.Geometry * System.Windows.Media.Brush -> unit
Protected Overridable Sub OnDraw (drawingContext As DrawingContext, stylusPoints As StylusPointCollection, geometry As Geometry, fillBrush As Brush)

매개 변수

drawingContext
DrawingContext

스트로크가 렌더링되는 DrawingContext 개체입니다.

stylusPoints
StylusPointCollection

그릴 스트로크의 세그먼트를 나타내는 StylusPointCollection입니다.

geometry
Geometry

마우스 포인터의 경로를 나타내는 Geometry입니다.

fillBrush
Brush

현재 스트로크의 모양을 지정하는 브러시입니다.

예제

다음 예제에서는 재정의 하는 방법에 설명 합니다 OnDraw 동적으로 사용 하 여 디지털 잉크를 렌더링 하는 메서드를 LinearGradientBrush입니다.

protected override void OnDraw(DrawingContext drawingContext,
                               StylusPointCollection stylusPoints,
                               Geometry geometry, Brush fillBrush)
{
    // Create a new Brush, if necessary
    if (brush == null)
    {
        Color primaryColor;

        if (fillBrush is SolidColorBrush)
        {
            primaryColor = ((SolidColorBrush)fillBrush).Color;
        }
        else
        {
            primaryColor = Colors.Red;
        }

        brush = new LinearGradientBrush(Colors.Blue, primaryColor, 20d);
    }

    drawingContext.DrawGeometry(brush, null, geometry);
}
Protected Overrides Sub OnDraw(ByVal drawingContext As DrawingContext, _
                               ByVal stylusPoints As StylusPointCollection, _
                               ByVal geometry As Geometry, _
                               ByVal fillBrush As Brush)

    ' Create a new Brush, if necessary
    If brush Is Nothing Then

        Dim primaryColor As Color

        If TypeOf fillBrush Is SolidColorBrush Then
            primaryColor = CType(fillBrush, SolidColorBrush).Color
        Else
            primaryColor = Colors.Red
        End If

        brush = New LinearGradientBrush(Colors.Blue, primaryColor, 20.0)

    End If

    drawingContext.DrawGeometry(brush, Nothing, geometry)

End Sub

상속자 참고

재정의 하는 경우 OnDraw(DrawingContext, StylusPointCollection, Geometry, Brush) 파생된 클래스에서 호출 해야 기본 클래스 OnDraw(DrawingContext, StylusPointCollection, Geometry, Brush) 메서드.

적용 대상