private void Domousemove(ContentControl img, MouseEventArgs e) { if (e.LeftButton != MouseButtonState.Pressed) { return; } Point point = image.TranslatePoint(new Point(0, 0), (UIElement)picWindow); Debug.WriteLine(point.X + " " + point.Y); if (OutRange(point)) { T_X = 0; T_Y = 0; mouseXY = new Point(); mouseDown = false; return; } var position = e.GetPosition(img); T_X -= mouseXY.X - position.X; T_Y -= mouseXY.Y - position.Y; mouseXY = position; }