0

「CanvasContainInkCanvas」というキャンバスに含まれる画像とインクキャンバスを表示する「drawCanvas」というキャンバスがあります。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 以外で選択を使用するにはどうすればよいですか?

4

1 に答える 1

2

その上に設定ClipToBounds="False"InkCanvasます。デフォルトでは、に設定されていTrueます。

于 2011-01-13T08:46:06.390 に答える