垂直滚动条导致水平滚动条。 [英] Vertical scroll bar cause horizontal scroll bar.

查看:171
本文介绍了垂直滚动条导致水平滚动条。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小组。它包含一个用户控件。最初两者都有相同的大小。

I have one panel. It contains one user control. Initially both has same size.

Panel pad = new Panel();
UserControl uc = new UserControl();

uc.Size = pad.Size;



但是有时候用户控制的高度可以增加因此我设置了AutoScroll = true 。


But there are situation when height of user control can be increased hence I have set AutoScroll = true.

pad.AutoScroll = true;





当UC的高度发生变化时,会出现垂直滚动条,这会导致水平滚动条。



简而言之,垂直滚动条会导致水平滚动条。

请建议我解决方案,以便垂直滚动时不会出现水平滚动条酒吧出现。



提前致谢,

Pushkar



我尝试过:



我也尝试设置Dock属性。

UC.Dock = DockStyle.Fill ;



但是设置DockStyle.Fill后,即使UC的高度发生变化,也不会出现面板滚动条。



As height of UC changes, Vertical Scroll bar appears and this cause horizontal scroll bar.

In short, vertical scroll bar cause horizontal scroll bar.
Please suggest me solution so that horizontal scroll bar does not appear when Vertical scroll bar appears.

Thanks in advance,
Pushkar

What I have tried:

I have also tried to set Dock property.
UC.Dock = DockStyle.Fill;

But setting DockStyle.Fill, scroll bar of panel does not appear, even if height of UC is changed.

推荐答案

没有办法避免这种情况:垂直滚动条的额外宽度意味着它下面的信息不再可见,因此需要一个水平滚动条让用户滚动到看到它!

唯一的选择是:

1)让滚动条始终可见。这样它就不会跳并且在需要时看起来很糟糕。

2)加宽面板或缩小它所包含的控件以允许垂直滚动条宽度。
There is no way to avoid this: the "extra width" of the vertical scroll bar means that the information "under" it is no longer visible, so a horizontal scroll bar is needed to let the user scroll to see it!
The only options are:
1) Make scrolls bars always visible. That way it doesn't "jump" and look bad when they are needed.
2) Widen the panel or narrow the control it contains to allow for the vertical scroll bar width.


这篇关于垂直滚动条导致水平滚动条。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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