Как показать изображение за пределами inkcanvas

StackOverflow https://stackoverflow.com/questions/4678116

  •  10-10-2019
  •  | 
  •  

Вопрос

У меня есть холст под названием «DrawCanvas», чтобы показать изображения и чернил, которые содержатся в холсте, называемом «CanvascontaininkCanvas». Я могу масштабировать, используя Matrixtransform.

//Get the image that's being manipulation.
Canvas element = (Canvas)e.Source;
 //Ues the matrix of the transform to manipulation the element's appearance.
Matrix matrix = ((MatrixTransform)drawCanvas.RenderTransform).Matrix;
//Get the ManipulationDelta object.
ManipulationDelta deltaManipulation = e.DeltaManipulation;
//Find the old center, and apply any previous manipulations.
Point center = new Point(element.ActualWidth / 2, element.ActualHeight / 2);
//Apply new move manipulation (if it exists).
center = matrix.Transform(center);
 //Apply new zoom manipulation (if it exists).
matrix.ScaleAt(deltaManipulation.Scale.X, deltaManipulation.Scale.Y, center.X, center.Y);
//Translation (pan) 
matrix.Translate(e.DeltaManipulation.Translation.X, e.DeltaManipulation.Translation.Y);
//Set the final matrix.
((MatrixTransform)drawCanvas.RenderTransform).Matrix = matrix;
// set the matrix of canvas that contain inkcanvas
((MatrixTransform)CanvasContainInkCanvas.RenderTransform).Matrix = matrix;

Если я увеличиваю масштаб, я смогу увидеть изображения вне холста.alt text

Я хочу скопировать изображения с холста в Inkcanvas, чтобы использовать выбор. Моя проблема заключается в том, что изображения не могут быть показаны за пределами inkcanvas.

alt text

Как показывать изображения вне Inkcanvas?

Спасибо

Обновлять: Как я могу использовать выбор за пределами inkcanvas?

Это было полезно?

Решение

Установлен ClipToBounds="False" на что InkCanvas. Анкет По умолчанию это установлено на True.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top