在面板C#中滚动多个控件 [英] Scrolling with multiple controls in panel C#

查看:113
本文介绍了在面板C#中滚动多个控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!



我有一个包含4个控制的表格。一个面板,包含2个DataGridViews和1个Label。首先是datagridview,然后是标签,然后是最后一个datagridview。表单的特定大小为600x400。我还希望第一个datagridview应该具有来自第一个datagridview的所有单元格高度+标题单元格高度的确切高度。如果它大于400,则右侧应该有一个滚动条。如果用户向下滚动,他应该是标签和2. DataGridView。如果高度小于400,可能是300,那么它应该已经显示标签和右侧的滚动条。我怎么能这样做?



谢谢!



我的尝试:



我不知道如何将datagridview高度调整到所有单元格高度的确切高度,并为其余控件添加scrollview

Hello!

I have a Form with 4 Controls. One panel, which contains 2 DataGridViews and 1 Label. First there is a datagridview, then the label and then the last datagridview. The Form has a specific size like 600x400. I also want that the first datagridview should have the exact height of all cell height + header cell height from the first datagridview. If its bigger than 400, there should be a scrollbar on the right. If the user scrolls down, he should the the label and the 2. DataGridView. If the Height is less than 400, maybe 300, then it should show already the label and a scrollbar on the right. How could I do that?

Thanks!

What I have tried:

I dont know how I could make the datagridview height to the exact height of all cells height and adding a scrollview for the rest controls

推荐答案

ScrollableControl.AutoScroll Property (System.Windows.Forms) [ ^ ]



如何:冻结Windows窗体DataGridView控件中的列Microsoft Docs [ ^ ]


这篇关于在面板C#中滚动多个控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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