【问题标题】:How to move an image on a touch in windows Phone 8?如何在 Windows Phone 8 中通过触摸移动图像?
【发布时间】:2014-07-24 23:53:03
【问题描述】:

我可以使用捏放大和缩小我在画布中拍摄的图像。但我也希望在单指触摸上移动图像以实现捏缩放功能,我必须用两根手指触摸。我使用操作增量进行缩放。任何人都可以建议

private void OnManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e)
{
    if (e.DeltaManipulation.Scale.X > 0.0 && e.DeltaManipulation.Scale.Y > 0.0)
    {
        // Scale in the X direction
        double tmp = PenguinTransform.ScaleX * e.DeltaManipulation.Scale.X;

        if (tmp < 1.0)
            tmp = 1.0;
        else if (tmp > 4.0)
            tmp = 4.0;

        PenguinTransform.ScaleX = tmp;

        // Scale in the Y direction
        tmp = PenguinTransform.ScaleY * e.DeltaManipulation.Scale.Y;

        if (tmp < 1.0)
           tmp = 1.0;
        else if (tmp > 4.0)
           tmp = 4.0;

        PenguinTransform.ScaleY = tmp;               
    }
}

【问题讨论】:

    标签: c# xaml windows-phone-8


    【解决方案1】:

    我建议使用 Hold 事件来定义图像已准备好移动,然后使用操作事件来控制图像的移动。我已经在不同的 SO 线程上更详细地解释了这种方法。请在此处找到它Windows phone 8 drag and drop grid in grid by user

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多