.NET - 用户控件拖放放大器;掉落 - 子控件控件、放大器、拖放、用户

2023-09-06 04:57:36 作者:空城,独留我一人

我有FlowLayoutPanel的和用户控件的它与拖&放;下降的重新排序。这类作品。但问题是,孩子控制实际父用户控件的prevent拖动。

I have FlowLayoutPanel and UserControl's on it with drag & drop reordering. This sort of works. But the problem is that child controls prevent dragging of the actual parent UserControl.

所以我的问题是如何实现拖动包含子控件用户控件的?

So my question is how to enable dragging of a UserControl that contains child controls?

推荐答案

如果我理解你的权利,我有同样的问题,因为你和我所传播的子元素的活动,它的父就解决了。

If I understand you right I had the same problem as you and I solved it by propagating events of the child element to it's parent.

如果你有一个包含标签的可拖动用户控件。你必须在标签的事件发生时调用用户控件的事件。例如。在标签的on​​mousedown事件()调用用户控件的onmousedown事件(),只是通过事件参数数量。我没有找到一个比处理所需的阻力,并分别下降每个事件更好的办法。

If you have a draggable UserControl containing a label. You have to call the events of the UserControl when the events of the label occurs. E.g. in the Label's OnMouseDown() call the UserControl's OnMouseDown() and just pass the Event-Args. I didn't find a better way than handling each event that is required for drag and drop separately.