如何防止FlowLayoutPanel返回顶部 [英] How to prevent FlowLayoutPanel from returning to the top

查看:95
本文介绍了如何防止FlowLayoutPanel返回顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用flowlayoutpanel控件。我用它来填充一组面板,每个面板都包含一个交互式对象的简单UI。可能有几十个。有效,但每当托管FlowLayoutPanel的表单获得焦点时,FlowLayoutPanel都会跳回到顶部。这很烦人,因为它迫使用户滚动并找到他/她的位置。

关于如何防止这种情况的想法非常受欢迎!



我尝试创建一个本地int来保存当前的垂直滚动位置(值),然后在Paint事件中恢复它。这确实看起来没问题,但控件反弹到位。它仍然会自动滚动到顶部,然后弹回到正确(保存)的位置。这对我来说看起来真的很不专业所以我仍在寻找合适的解决方案。



Des

I'm using the flowlayoutpanel control. I am using it to populate a group of panels each of which contains a simple UI for an interactive object. There can be dozens of them. Works a treat, but whenever the form hosting the FlowLayoutPanel gets focus, the FlowLayoutPanel jumps back to the top. This is annoying as it forces the user to scroll and find where he/she was.
Thoughts on how to prevent this would be very welcome!

I've tried creating a local int to save the current vertical scroll position (value) and then restoring it in the Paint event. This does see to work ok, but the control "bounces" into position. It still scrolls to the top automatically, and then bounces to the correct (saved) position. That just looks really unprofessional to me so I am still looking for a proper solution.

Des

推荐答案

我有类似的情况,我使用Panel控件与多个GroupBox控件停靠TOP。面板自动滚动。当用户在其中一个GroupBox控件中执行某些操作时,它会滚动回到面板中的顶部控件。为了解决这个问题,我保留了对正在使用的GroupBox的引用,在用户操作完成后,我调用Focus方法使GroupBox恢复为活动。
I have a similar situation where I use a Panel control with a number of GroupBox controls docked TOP. The panel auto-scrolls. When the user does something within one of the GroupBox controls it was scrolling back to the top control within the panel. To solve the issue I kept a reference to the GroupBox being worked with and after the user action completes, I call the Focus method to bring the GroupBox back to being "active".


这篇关于如何防止FlowLayoutPanel返回顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆