DynamicRenderer.OnDraw 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
잉크를 실시간으로 그려 태블릿 펜 또는 기타 포인팅 장치에서 "흐름"하는 것처럼 보입니다.
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 그릴 스트로크의 세그먼트를 나타내는 값입니다.
- 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) 메서드를 호출해야 합니다.