0

我有一个名为“drawCanvas”的画布来显示包含在名为“CanvasContainInkCanvas”的画布中的图像和inkcanvas。我可以使用 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;

如果我缩小,我可以看到画布外的图像。 替代文字

我想将图像从画布复制到 inkcanvas 以使用选择。我的问题是图像无法在inkcanvas 之外显示。

替代文字

如何在 inkcanvas 之外显示图像?

谢谢

更新:如何在 inkcanvas 之外使用选择?

4

1 回答 1

2

设置ClipToBounds="False"在那InkCanvas。默认情况下,它设置为True.

于 2011-01-13T08:46:06.390 回答