开发者

Winform problem with autoscrolling of the ScrollableControl

I have a problem with autoscrolling of the .NET ScrollableControl. I am using TabPage which inheri开发者_运维技巧ted from ScrollableControl in the class hierarachy. Every TabPage object has only 1 UserControl derived control which draws the landscape; there is no other control on the tabpage.

The usage of my application is its user will drag a file from windows explorer and drop into the TabPage. As more files are dragged and dropped, the UserControl derived control will expand to accomodate the drawing of the files and auto-scrolling will be enabled.

The problem I have is when I mouse-click on the UserControl control, the vertical and horizontal scrollbars will scroll back to (0,0) position. I want the vertical and horizontal scrollbars to remain at their original scrolled position whatever happens. I believe when I mouse-click on the UserControl control, the UserControl control comes into focus and that triggers the auto-scrolling to (0,0) position.

Please help.

Thanks in advance!


UserControl derives from ScrollableControl as well. It should have its AutoScroll property set to true, not the TabPage. Set its AutoScrollMinSize property instead of its Size.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜