简体   繁体   English

WPF中组合元素的部分缩放

[英]Partial scaling of a composed elements in WPF

I am in the following situation: designing an interactive flow-chart GUI. 我遇到以下情况:设计交互式流程图GUI。 I stuck with animating a scale down animation of the flow-chart. 我坚持使用流程图的缩小动画制作动画。 Composed elements of the flow-chart are minimized, but they keep being active. 流程图的组合元素被最小化,但它们保持活跃。

I have something like this: 我有这样的事情:

            <Canvas Canvas.Left="55" Canvas.Top="720" Height="100" Width="500" Tag="stepDown">
                <Line Stroke="#99CCFF" StrokeThickness="8" X1="0" X2="720" Y1="10" Y2="10">
                <Polygon Stroke="Black" StrokeThickness="2" Points="0,30 40,0 40,60" Canvas.Left="-20" Canvas.Top="-20" Fill="#99CCFF"></Polygon>
                <Polygon Stroke="Black" StrokeThickness="2" Points="0,0 0,60 40,30" Canvas.Left="720" Canvas.Top="-20" Fill="#99CCFF"></Polygon>
                <Image Canvas.Left="-50" Canvas.Top="-70" Height="53" Name="image32" Source="img/outlet.png" Stretch="Fill" Width="30" Tag="relative" />
            </Canvas>

And I would like to shift the whole canvas and its elements to the left - no problem with Translate Transform . 我想将整个画布及其元素向左移动 - 翻译变换没问题。 Furthermore I would like to scale down only the Line , no problem with Scale Transform . 此外,我想只缩小Line ,没有Scale Transform的问题。

But (!) at the same time, I want that the Polygons stick to the two line endings of the line. 但是(!)同时,我希望多边形坚持线的两行结尾。 When scaling down only the line, the Polygons , at least one, floats away. 当仅按比例缩小线时, 多边形 (至少一个)会浮动。

I don't know how to dock these elements or define them at a relative basis. 我不知道如何停靠这些元素或在相对基础上定义它们。 It works fine with a scale down on the whole Canvas , but this changes the Polygon and Images as well. 它可以在整个画布上缩小尺寸,但这也会改变多边形图像

In order to me you have to define hanchors points, as attached properties. 为了我,你必须定义hanchors点作为附加属性。 Even define a behavior that track these points accordingly to poligon placements. 甚至可以定义一种行为,根据poligon展示位置跟踪这些点。 Then you can bind these property to the line start/end point. 然后,您可以将这些属性绑定到行开始/结束点。 In this way line should stay gripped to the polygons. 这样,线应该保持对多边形的控制。 But I did'nt try, is just a design idea. 但我没试过,只是一个设计理念。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM