C# - 将面板的自动滚动设置为面板内的自动滚动? [英] C# - set autoscrolls of a panel to the autoscroll of the panel within?

查看:95
本文介绍了C# - 将面板的自动滚动设置为面板内的自动滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨CodeProject,



我目前在面板中有一个面板,另一个面板(名为TilePanel),可以更改其大小,因此获得自己的滚动条(AutoScroll属性设置为true)。我把它放在另一个面板(对齐面板)中,这样我就可以正确地居中,而不会弄乱任何绘图代码或其他事件。



现在我的问题是,我可以从TilePanel中删除自动滚动条,而是将这些自动滚动条放在包含它的较大面板中吗?



这是我用油漆做的一个例子。



我觉得它的价值也是如此在 pastebin上发布了AlignmentPanel。



最好的问候,

- 编辑



我尝试过:



我尝试将tilepanel autoscroll设置为false,然后创建了一个新的水平滚动条和一个垂直滚动条,并将它们添加到对齐面板中。然后,当滚动它们时,我将tilepanel的自动滚动值设置为新的滚动条值 - 但是,它似乎是错误并且表示这样做,可能我错过了一些东西,不确定。

Hey Codeproject,

I currently have a panel within a panel, the panel inside the other one (named TilePanel), can change its size and therefore gets its own scrollbars (AutoScroll property set to true). I've put it inside another panel (Alignment Panel) so I could center it properly without messing up any of the drawing code or other events.

Now my question is, is it possible for me to remove the auto scrolls from the TilePanel, and instead, put those auto scrolls in the bigger panel that encompasses it?

Here's an example I made in paint.

For what it's worth I've also published the AlignmentPanel on pastebin.

Best Regards,
- Eds

What I have tried:

I've tried setting the tilepanel autoscroll to false, then I created a new horizontal scrollbar and a vertical scrollbar, and added those to the alignment panel. Then when those are scrolled I set the autoscroll values of the tilepanel to the new scrollbars values - however, it seems to bug and spazz out doing this, maybe I'm missing something, not sure.

推荐答案

您可能会对以下文章感兴趣:设计嵌套控件 [ ^ ]



.net - 如果包含的控件太大而导致滚动条出现在可调整大小的面板中? - 堆栈溢出 [ ^ ]
These articles might be of interest to you: Designing Nested Controls[^]

.net - How to make scrollbars appear in a resizable panel when the contained control is too big for it? - Stack Overflow[^]


这篇关于C# - 将面板的自动滚动设置为面板内的自动滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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