问题描述
我需要绘制的数字信号,并能够将线路的每个部分在WPF
I need to draw digital signal and be able to move each part of the lines in WPF.
如下面的箭头图象表示向哪个方向线的部分可以移动。单击并拖动点击区域将移动整个广场左侧或右侧。
As shown in picture below the arrows indicate to which direction the part of the line can be moved. Clicking and dragging the "clickable area" will move the whole square left or right.
我想对夫妇的方式做到这一点:
I thought couple of ways to do it:
-
折线
对象。但我无法控制线的每一个部分。 -
行
对象。在每一个变化都行应该调整自己的位置。难以控制的点击区域。或许也很复杂。 -
边框
对象。每个部分实际上是一个边界,将显示/隐藏相应的边境一侧。我不知道如何容易使边界两侧移动。 - 在其他选项...
Polyline
object. But I cannot control each part of the line.Line
object. On each change all lines should adjust their locations. Hard to control "clickable area". Maybe also complicated.Border
object. Each section will actually be a border which will show/hide appropriate border side. I'm not sure how easy to make movable sides of the border.- Other options...
我的问题是,什么是开始这样做了最正确的方法是什么?
My question is, what is the most correct way to start doing it?
推荐答案
一对夫妇的事情要考虑...
A couple of things to consider...
-
在
拇指
是一个很好的控制,从开始你拖动的东西,因为它已经提供了适当的事件,你可以处理移动它。通过模板化它,你可以给它任何你喜欢的形状。
a
Thumb
is a good control to start your draggable things from, as it already provides proper events you can handle to move it. By templating it you can give it any shape you like.
您可以通过巧妙使用电网
和适当放置电网分离得到免费的可拖动线。如果不工作,然后4长方形可以很好地工作。你把它们放在一个 DockingPanel
与位置上,左,右,最后一个填充,你有足够的基元反应到所有需要的事件。
you may get draggable lines for free through clever use of a Grid
and appropriately placed grid splitters. If that doesn't work then 4 rectangles could work well. You put them in a DockingPanel
with placement top, left, right and the last one fill, and you have enough primitives to react to all desired events.
这篇关于如何在WPF中绘制数字信号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!