简体   繁体   English

Windows窗体中的AutoScroll事件

[英]AutoScroll event in WIndows Forms

I have a windows form with two controls, one mail control (Dock = Fill) and a property control (Dock = Right). 我有一个带有两个控件的Windows窗体,其中一个邮件控件(Dock = Fill)和一个属性控件(Dock = Right)。 The property control is set to AutoScroll. 属性控件设置为“自动滚动”。 It has some expandable panels and if the user expands too many panels the height of the control is larger than the window height and I set the AutoScroll property in order to automatically display scrollbars in this case - this does work. 它具有一些可扩展的面板,并且如果用户扩展了太多的面板,则控件的高度大于窗口的高度,在这种情况下,我设置了AutoScroll属性以自动显示滚动条-这确实可行。 However the scrollbar is plotted over the property controls. 但是,滚动条绘制在属性控件上。 The scrollbars of course needs some place but I would like the property window to grow in width as long as the scroll bar is shown (and hence reduce the size of the main control a bit) so that the scrollbar is on the right side of the property control which is completely shown. 滚动条当然需要一些位置,但是我希望属性窗口在显示滚动条的情况下能够增加宽度(从而稍微减小主控件的大小),以便滚动条位于控件的右侧。完全显示的属性控件。

Can you give me a hint? 你能给我一个提示吗? Do I need to change some properties of the controls? 我是否需要更改控件的某些属性? Or is there an Event "ScrollBarsShown" or something which I could catch and manually extend the width of the property control? 还是有一个事件“ ScrollBarsShown”或我可以捕获并手动扩展属性控件宽度的东西?

Thank you very much! 非常感谢你!

Put these controls in a TableLayoutPanel . 将这些控件放在TableLayoutPanel The arrangement should be two columns, one row. 安排应为两列,一行。 Column0 would be set to 100%, while Column1 would be AutoSize. Column0将设置为100%,而Column1将设置为AutoSize。 The Row could be either. 行可能是。

Then just dock fill the TableLayoutPanel in your form. 然后只需将TableLayoutPanel停靠在表单中即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM