TouchDevice.Capture 메서드

정의

지정된 요소에 터치를 캡처합니다.

오버로드

Capture(IInputElement)

Element 캡처 모드를 사용하여 지정된 요소에 터치를 캡처합니다.

Capture(IInputElement, CaptureMode)

지정된 CaptureMode를 사용하여 지정된 요소에 터치를 캡처합니다.

Capture(IInputElement)

Element 캡처 모드를 사용하여 지정된 요소에 터치를 캡처합니다.

public:
 bool Capture(System::Windows::IInputElement ^ element);
public bool Capture (System.Windows.IInputElement element);
member this.Capture : System.Windows.IInputElement -> bool
Public Function Capture (element As IInputElement) As Boolean

매개 변수

element
IInputElement

터치식 입력을 캡처하는 요소입니다.

반환

요소에 터치가 캡처되었으면 true이고, 그렇지 않으면 false입니다.

예외

elementUIElement, UIElement3D 또는 ContentElement가 아닌 경우

예제

다음 예제에서는 처리 합니다 TouchDown 에서 일어나는 이벤트를 Canvas입니다. 터치를 눌렀음을 합니다 Canvas, TouchDevice 에 캡처되는지를 Canvas입니다.

이 예제는에서 사용할 수 있는 보다 큰 예제의 일부는 TouchDevice 클래스 개요입니다.

private void canvas_TouchDown(object sender, TouchEventArgs e)
{
    Canvas _canvas = (Canvas)sender as Canvas;
    if (_canvas != null)
    {
        _canvas.Children.Clear();
        e.TouchDevice.Capture(_canvas);

        // Record the ID of the first touch point if it hasn't been recorded.
        if (firstTouchId == -1)
            firstTouchId = e.TouchDevice.Id;
    }
}
' Touch Down
Private Sub canvas_TouchDown(ByVal sender As System.Object, ByVal e As System.Windows.Input.TouchEventArgs)
    Dim _canvas As Canvas = CType(sender, Canvas)
    If (_canvas IsNot Nothing) Then
        _canvas.Children.Clear()
        e.TouchDevice.Capture(_canvas)

        ' Record the ID of the first touch point if it hasn't been recorded.
        If firstTouchId = -1 Then
            firstTouchId = e.TouchDevice.Id
        End If
    End If
End Sub

설명

이미 TouchDevice 다른 요소에 캡처된 경우 을 요소에 캡처할 수 없습니다.

적용 대상

Capture(IInputElement, CaptureMode)

지정된 CaptureMode를 사용하여 지정된 요소에 터치를 캡처합니다.

public:
 bool Capture(System::Windows::IInputElement ^ element, System::Windows::Input::CaptureMode captureMode);
public bool Capture (System.Windows.IInputElement element, System.Windows.Input.CaptureMode captureMode);
member this.Capture : System.Windows.IInputElement * System.Windows.Input.CaptureMode -> bool
Public Function Capture (element As IInputElement, captureMode As CaptureMode) As Boolean

매개 변수

element
IInputElement

터치를 캡처하는 요소입니다.

captureMode
CaptureMode

사용할 캡처 정책입니다.

반환

요소에 터치가 캡처되었으면 true이고, 그렇지 않으면 false입니다.

예외

elementUIElement, UIElement3D 또는 ContentElement가 아닌 경우

설명

이미 TouchDevice 다른 요소에 캡처된 경우 을 요소에 캡처할 수 없습니다.

적용 대상