0
我有一個大約4048x8096的畫布,當我嘗試放大時,它沒有放大手勢點,它總是移動到Point(0,0),這是畫布的位置,這裏是我正在使用的代碼: 當達到縮放限制時,它也會閃爍。放大觸摸點
private void GraphSurface_ManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e)
{
var matrix = ((MatrixTransform)this.RenderTransform).Matrix;
Point center = new Point(this.ActualWidth/2, this.ActualHeight/2);
center = matrix.Transform(center);
if (Scale <= ZoomInLimit && Scale >= ZoomOutLimit)
{
matrix.ScaleAt(e.DeltaManipulation.Scale.X, e.DeltaManipulation.Scale.Y, center.X, center.Y);
}
if (Scale > ZoomInLimit)
{
matrix.M11 -= 0.001;
matrix.M22 -= 0.001;
}
else if (Scale < ZoomOutLimit)
{
matrix.M11 = ZoomOutLimit + 0.001;
matrix.M22 = ZoomOutLimit + 0.001;
}
((MatrixTransform)this.RenderTransform).Matrix = matrix;
e.Handled = true;
}
看看[如何自動中心在ScrollViewer中同時縮放內容](http://www.xaml.in/xaml/how-to-auto-center-the-content-in- a-scrollviewer-zooming)幫助。 – pushpraj 2014-11-09 00:41:25