2011-01-13 12 views
0

"CanvasContainInIncCanvas"というキャンバスに含まれる画像とインクキャンバスを表示するために、「drawCanvas」というキャンバスがあります。 MatrixTransformを使ってズームアウトできます。inkcanvasの外側に画像を表示する方法

//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の外に見ることができないことです。私はinkcanvas外の画像を表示するにはどうすればよい

alt text

おかげ

更新:はどのように私はinkcanvas外の選択を使用していますか?

答えて

2

ClipToBounds="False"InkCanvasに設定してください。デフォルトではTrueに設定されています。

+0

今、画像を表示できますが、新しい問題があります。 inkcanvasの外で選択を使用するにはどうすればよいですか? –

+0

「InkCanvas外の選択」とはどういう意味ですか? – decyclone

関連する問題