开发者

How to scroll a flowlayoutpanel while dragging?

In my Windows Forms application, I'm using a FlowLayoutPanel control to display a list of items to users. I've been able to successfully implement reordering the items in the FlowLayoutPanel by having the user drag the control to the desired position within the FlowLayoutPanel.

But I don't know how to 开发者_开发百科scroll the FlowLayoutPanel when the user drags an item past the boundaries of the panel. I've seen examples for ListView controls but those techniques don't seem to apply to the FlowLayoutPanel.

Can someone provide sample code, preferably in c#, on how to implement this functionality?

I can provide code examples of my current reordering methodology if desired.

Thanks!


Add a call to the ScrollControlIntoView() method after a control has been moved.


This can be achieved by setting the AutoScrollPosition property.

In the DragOver Event:

flowLayoutPanel1.AutoScrollPosition = flowLayoutPanel1.PointToClient(new Point(e.X, e.Y));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜