C# 如何在windows Phone 8中移动触摸屏上的图像?
我能够使用收缩放大和缩小我在画布上拍摄的图像。但我也希望在单手指触摸上移动图像,以实现我必须用两个手指触摸的捏缩缩放功能。我使用操纵增量进行缩放。有人能推荐吗C# 如何在windows Phone 8中移动触摸屏上的图像?,c#,xaml,windows-phone-8,C#,Xaml,Windows Phone 8,我能够使用收缩放大和缩小我在画布上拍摄的图像。但我也希望在单手指触摸上移动图像,以实现我必须用两个手指触摸的捏缩缩放功能。我使用操纵增量进行缩放。有人能推荐吗 private void OnManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e) { if (e.DeltaManipulation.Scale.X > 0.0 && e.DeltaManipu
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;
}
}
操作Delta(对象发送方,System.Windows.Input.OperationDeltaEventArgs e)上的私有无效
{
if(e.DeltaManipulation.Scale.X>0.0&&e.DeltaManipulation.Scale.Y>0.0)
{
//在X方向上缩放
double tmp=PenguinTransform.ScaleX*e.DeltaManipulation.Scale.X;
如果(tmp<1.0)
tmp=1.0;
否则如果(tmp>4.0)
tmp=4.0;
expndtw-1.ScaleX=tmp;
//在Y方向上缩放
tmp=transform.ScaleY*e.DeltaManipulation.Scale.Y;
如果(tmp<1.0)
tmp=1.0;
否则如果(tmp>4.0)
tmp=4.0;
expndtw-1.ScaleY=tmp;
}
}
我建议使用保持事件来定义图像已准备好移动,然后使用操纵事件来控制图像的移动。我已经在另一个SO线程上更详细地解释了这种方法。请在这里找到 希望这有帮助