【问题标题】:How to show image outside inkcanvas如何在inkcanvas外显示图像
【发布时间】:2011-01-13 08:39:48
【问题描述】:

我有一个名为“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 之外使用选择?

【问题讨论】:

    标签: c# wpf inkcanvas


    【解决方案1】:

    InkCanvas 上设置ClipToBounds="False"。默认设置为True

    【讨论】:

    • 好的,我现在可以显示图片了,但是我遇到了新问题。如何在 inkcanvas 之外使用选择?
    • Selection outside InkCanvas 是什么意思?
    猜你喜欢
    • 1970-01-01
    • 2018-03-15
    • 1970-01-01
    • 2021-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多