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

마우스 포인터의 경로를 나타내는 A 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) 메서드를 호출해야 합니다.

적용 대상