2
작은 컨테이너 (또는이 같은 smthg)에 표시해야하는 큰 이미지가 있습니다. 사용자는 이미지를 위, 아래, 왼쪽 & 왼쪽으로 이동할 수 있어야합니다. Google지도와 같아야합니다.Google지도와 같은 이미지 이동
내가 시작할 수있는 곳과 해결 방법을 알고 계신가요?
작은 컨테이너 (또는이 같은 smthg)에 표시해야하는 큰 이미지가 있습니다. 사용자는 이미지를 위, 아래, 왼쪽 & 왼쪽으로 이동할 수 있어야합니다. Google지도와 같아야합니다.Google지도와 같은 이미지 이동
내가 시작할 수있는 곳과 해결 방법을 알고 계신가요?
아마도 DeepZoom과 같은 것이 작동 할 것입니다.
패닝 기능이있는 간단한 UserControl 또는 CustomControl을 만들 수도 있습니다. 캔버스의 자식이어야하는 이미지에서 TranslateTransform을 조작하기 위해 일부 마우스 이벤트를 처리하는 캔버스가 있습니다.
이벤트 처리 개요 :
// Add this transform to the image as RenderTransform
private TranslateTransform _translateT = new TranslateTransform();
private Point _lastMousePos = new Point();
private void This_MouseDown(object sender, MouseButtonEventArgs
{
if (e.ChangedButton == PanningMouseButton)
{
this.Cursor = Cursors.ScrollAll;
_lastMousePos = e.GetPosition(null);
this.CaptureMouse();
}
}
private void This_MouseUp(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == PanningMouseButton)
{
this.ReleaseMouseCapture();
this.Cursor = Cursors.Arrow;
}
}
private void This_MouseMove(object sender, MouseEventArgs e)
{
if (this.IsMouseCaptured)
{
Point newMousePos = e.GetPosition(null);
Vector shift = newMousePos - _lastMousePos;
_translateT.X += shift.X;
_translateT.Y += shift.Y;
_lastMousePos = newMousePos;
}
}
감사합니다. DeepZoom은 훌륭한 솔루션 인 것처럼 보이지만 리트 비트는 과부하 상태입니다. – timmes
거대한 이미지의 성능 측면에서 더 나 빠졌지 만 더 단순한 또 다른 제안 개요가 추가되었습니다. –
H.B. 감사합니다! 그것은 나를 위해 작동하고 성능이 그렇게 나쁘지는 않다;) – timmes