TouchDevice.Capture TouchDevice.Capture TouchDevice.Capture TouchDevice.Capture Method

정의

지정된 요소에 터치를 캡처합니다.Captures a touch to the specified element.

오버로드

Capture(IInputElement) Capture(IInputElement) Capture(IInputElement) Capture(IInputElement)

Element 캡처 모드를 사용하여 지정된 요소에 터치를 캡처합니다.Captures a touch to the specified element by using the Element capture mode.

Capture(IInputElement, CaptureMode) Capture(IInputElement, CaptureMode) Capture(IInputElement, CaptureMode)

지정된 CaptureMode를 사용하여 지정된 요소에 터치를 캡처합니다.Captures a touch to the specified element by using the specified CaptureMode.

Capture(IInputElement) Capture(IInputElement) Capture(IInputElement) Capture(IInputElement)

Element 캡처 모드를 사용하여 지정된 요소에 터치를 캡처합니다.Captures a touch to the specified element by using the Element capture mode.

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 IInputElement IInputElement IInputElement

터치식 입력을 캡처하는 요소입니다.The element that captures the touch input.

반환

요소에 터치가 캡처되었으면 true이고, 그렇지 않으면 false입니다.true if the element was able to capture the touch; otherwise, false.

예외

예제

다음 예제에서는 처리 합니다 TouchDown 에서 일어나는 이벤트를 Canvas입니다.The following example handles the TouchDown events that occur on a Canvas. 터치를 눌렀음을 합니다 Canvas, TouchDevice 에 캡처되는지를 Canvas입니다.When a touch is pressed on the Canvas, the TouchDevice is captured to the Canvas.

이 예제는에서 사용할 수 있는 보다 큰 예제의 일부는 TouchDevice 클래스 개요입니다.This example is part of a larger example that is available in the TouchDevice class overview.

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 다른 요소에 이미 캡처되어 있으면 요소에 캡처할 수 없습니다.A TouchDevice cannot be captured to an element if it is already captured to another element.

Capture(IInputElement, CaptureMode) Capture(IInputElement, CaptureMode) Capture(IInputElement, CaptureMode)

지정된 CaptureMode를 사용하여 지정된 요소에 터치를 캡처합니다.Captures a touch to the specified element by using the specified 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

매개 변수

element
IInputElement IInputElement IInputElement IInputElement

터치를 캡처하는 요소입니다.The element that captures the touch.

captureMode
CaptureMode CaptureMode CaptureMode CaptureMode

사용할 캡처 정책입니다.The capture policy to use.

반환

요소에 터치가 캡처되었으면 true이고, 그렇지 않으면 false입니다.true if the element was able to capture the touch; otherwise, false.

예외

설명

TouchDevice 다른 요소에 이미 캡처되어 있으면 요소에 캡처할 수 없습니다.A TouchDevice cannot be captured to an element if it is already captured to another element.

적용 대상