在 xaml 中,我将我的画布定义为:
<Canvas Name="GameCanvas">
<Canvas.RenderTransform>
<CompositeTransform x:Name="CanvasRenderTransform" />
</Canvas.RenderTransform>
在 c# 中,我定义了以下内容,我在其中存储初始比例并在压缩时对其进行修改:
private void GestureListener_DragDelta(object sender, DragDeltaGestureEventArgs e)
{
Point p = e.GetPosition(GameCanvas);
CanvasRenderTransform.TranslateX = p.X - originDragPoint.X;
CanvasRenderTransform.TranslateY = p.Y - originDragPoint.Y;
}
private void GestureListener_DragStarted(object sender, DragStartedGestureEventArgs e)
{
originDragPoint = e.GetPosition(GameCanvas);
}
任何人都知道为什么当我移动它时它会闪烁并且移动得很差?