ManipulationInertiaStartingEventHandler 代理人

定義

ManipulationInertiaStarting イベントを処理するメソッドを表します。

public delegate void ManipulationInertiaStartingEventHandler(Platform::Object ^ sender, ManipulationInertiaStartingRoutedEventArgs ^ e);
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.Guid(1575130813, 28444, 24416, 145, 128, 16, 112, 82, 130, 87, 108)]
public delegate void ManipulationInertiaStartingEventHandler(object sender, ManipulationInertiaStartingRoutedEventArgs e);
Public Delegate Sub ManipulationInertiaStartingEventHandler(sender As Object, e As ManipulationInertiaStartingRoutedEventArgs)

パラメーター

sender
Object

Platform::Object

ハンドラーがアタッチされているオブジェクト。

e
ManipulationInertiaStartingRoutedEventArgs

イベントのイベント データ。

属性

次のコード例は 、入力サンプルのシナリオ 4 を示しています。 このコードでは、ManipulationStarting、ManipulationStartedManipulationDeltaManipulationInertiaStartingManipulationCompleted イベントを使用した直接操作の使用パターンをいくつか示します。

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();
}

適用対象