我有名为“ 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

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

alt text

我如何在墨水之外显示图像?

谢谢

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

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top