ManipulationInertiaStartingEventHandler 대리자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
ManipulationInertiaStarting 이벤트를 처리할 메서드를 나타냅니다.
public delegate void ManipulationInertiaStartingEventHandler(Platform::Object ^ sender, ManipulationInertiaStartingRoutedEventArgs ^ e);
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(3550307106, 31900, 18459, 130, 123, 200, 178, 217, 187, 111, 199)]
class ManipulationInertiaStartingEventHandler : MulticastDelegate
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(3550307106, 31900, 18459, 130, 123, 200, 178, 217, 187, 111, 199)]
public delegate void ManipulationInertiaStartingEventHandler(object sender, ManipulationInertiaStartingRoutedEventArgs e);
Public Delegate Sub ManipulationInertiaStartingEventHandler(sender As Object, e As ManipulationInertiaStartingRoutedEventArgs)
매개 변수
- sender
-
Object
Platform::Object
IInspectable
처리기가 연결된 개체입니다.
이벤트에 대한 이벤트 데이터입니다.
- 특성
Windows 요구 사항
디바이스 패밀리 |
Windows 10 (10.0.10240.0에서 도입되었습니다.)
|
API contract |
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)
|
예제
다음 코드 예제에서는 입력 샘플의 시나리오 4를 보여줍니다. 이 코드는 ManipulationStarting, ManipulationStarted, ManipulationDelta, ManipulationInertiaStarting 및 ManipulationCompleted 이벤트를 사용하여 직접 조작을 위한 몇 가지 사용 패턴을 보여 줍니다.
private TransformGroup _transformGroup;
private MatrixTransform _previousTransform;
private CompositeTransform _compositeTransform;
private bool forceManipulationsToEnd;
public Scenario4()
{
this.InitializeComponent();
forceManipulationsToEnd = false;
ManipulateMe.ManipulationStarting +=
new ManipulationStartingEventHandler(
ManipulateMe_ManipulationStarting);
ManipulateMe.ManipulationStarted +=
new ManipulationStartedEventHandler(
ManipulateMe_ManipulationStarted);
ManipulateMe.ManipulationDelta +=
new ManipulationDeltaEventHandler(
ManipulateMe_ManipulationDelta);
ManipulateMe.ManipulationCompleted +=
new ManipulationCompletedEventHandler(
ManipulateMe_ManipulationCompleted);
ManipulateMe.ManipulationInertiaStarting +=
new ManipulationInertiaStartingEventHandler(
ManipulateMe_ManipulationInertiaStarting);
InitManipulationTransforms();
}
private void InitManipulationTransforms()
{
_transformGroup = new TransformGroup();
_compositeTransform = new CompositeTransform();
_previousTransform = new MatrixTransform() {
Matrix = Matrix.Identity };
_transformGroup.Children.Add(_previousTransform);
_transformGroup.Children.Add(_compositeTransform);
ManipulateMe.RenderTransform = _transformGroup;
}
private void ManipulateMe_ManipulationStarting(object sender,
ManipulationStartingRoutedEventArgs e)
{
forceManipulationsToEnd = false;
e.Handled = true;
}
private void ManipulateMe_ManipulationStarted(
object sender, ManipulationStartedRoutedEventArgs e)
{
e.Handled = true;
}
private void ManipulateMe_ManipulationInertiaStarting(
object sender, ManipulationInertiaStartingRoutedEventArgs e)
{
e.Handled = true;
}
private void ManipulateMe_ManipulationDelta(
object sender, ManipulationDeltaRoutedEventArgs e)
{
if (forceManipulationsToEnd)
{
e.Complete();
return;
}
_previousTransform.Matrix = _transformGroup.Value;
Point center = _previousTransform.TransformPoint(
new Point(e.Position.X, e.Position.Y));
_compositeTransform.CenterX = center.X;
_compositeTransform.CenterY = center.Y;
_compositeTransform.Rotation = (e.Delta.Rotation * 180) / Math.PI;
_compositeTransform.ScaleX =
_compositeTransform.ScaleY = e.Delta.Scale;
_compositeTransform.TranslateX = e.Delta.Translation.X;
_compositeTransform.TranslateY = e.Delta.Translation.Y;
e.Handled = true;
}
private void ManipulateMe_ManipulationCompleted(object sender,
ManipulationCompletedRoutedEventArgs e)
{
e.Handled = true;
}
private void Scenario4Reset(object sender, RoutedEventArgs e)
{
Scenario4Reset();
}
void Scenario4Reset()
{
forceManipulationsToEnd = true;
ManipulateMe.RenderTransform = null;
InitManipulationTransforms();
}
Private _transformGroup As TransformGroup
Private _previousTransform As MatrixTransform
Private _compositeTransform As CompositeTransform
Private forceManipulationsToEnd As Boolean
Public Sub New()
Me.InitializeComponent()
forceManipulationsToEnd = False
AddHandler ManipulateMe.ManipulationStarting, AddressOf ManipulateMe_ManipulationStarting
AddHandler ManipulateMe.ManipulationStarted, AddressOf ManipulateMe_ManipulationStarted
AddHandler ManipulateMe.ManipulationDelta, AddressOf ManipulateMe_ManipulationDelta
AddHandler ManipulateMe.ManipulationCompleted, AddressOf ManipulateMe_ManipulationCompleted
InitManipulationTransforms()
End Sub
''' <summary>
''' Invoked when this page is about to be displayed in a Frame.
''' </summary>
''' <param name="e">Event data that describes how this page was reached. The Parameter
''' property is typically used to configure the page.</param>
Protected Overrides Sub OnNavigatedTo(e As NavigationEventArgs)
End Sub
Private Sub InitManipulationTransforms()
_transformGroup = New TransformGroup()
_compositeTransform = New CompositeTransform()
_previousTransform = New MatrixTransform() With { _
.Matrix = Matrix.Identity _
}
_transformGroup.Children.Add(_previousTransform)
_transformGroup.Children.Add(_compositeTransform)
ManipulateMe.RenderTransform = _transformGroup
End Sub
Private Sub ManipulateMe_ManipulationStarting(sender As Object, e As ManipulationStartingRoutedEventArgs)
forceManipulationsToEnd = False
e.Handled = True
End Sub
Private Sub ManipulateMe_ManipulationStarted(sender As Object, e As ManipulationStartedRoutedEventArgs)
e.Handled = True
End Sub
Private Sub ManipulateMe_ManipulationDelta(sender As Object, e As ManipulationDeltaRoutedEventArgs)
If forceManipulationsToEnd Then
e.Complete()
Exit Sub
End If
_previousTransform.Matrix = _transformGroup.Value
Dim center As Point = _previousTransform.TransformPoint(New Point(e.Position.X, e.Position.Y))
_compositeTransform.CenterX = center.X
_compositeTransform.CenterY = center.Y
_compositeTransform.Rotation = (e.Delta.Rotation * 180) / Math.PI
_compositeTransform.ScaleX = InlineAssignHelper(_compositeTransform.ScaleY, e.Delta.Scale)
_compositeTransform.TranslateX = e.Delta.Translation.X
_compositeTransform.TranslateY = e.Delta.Translation.Y
e.Handled = True
End Sub
Private Sub ManipulateMe_ManipulationCompleted(sender As Object, e As ManipulationCompletedRoutedEventArgs)
e.Handled = True
End Sub
Private Sub Scenario4ResetMethod(sender As Object, e As RoutedEventArgs)
Reset()
End Sub
Private Sub Reset()
forceManipulationsToEnd = True
ManipulateMe.RenderTransform = Nothing
InitManipulationTransforms()
End Sub
Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, value As T) As T
target = value
Return value
End Function