DataGridView左上角有奇怪的布局

时间:2016-04-04 15:26:52

标签: c# winforms datagridview tabcontrol

我在使用Metro Framework的C#Windows窗体应用程序中遇到了一个奇怪的布局问题。

在tabControl中有一个停靠的DataGridView。在左上角出现灰色条带。

Upperleft corner

当我点击它时它会消失。

Upperleft on hover

有谁知道如何删除它?

5 个答案:

答案 0 :(得分:1)

在将DataGridView添加到标签页后,您必须将DataGridView调到前面,调用BringToFront()方法。无需使用Dock属性。这为我修好了。

答案 1 :(得分:0)

我也遇到了同样的问题。我找到了这个解决方案。 我已经设置了datagridview dock属性来填充tabpage。 然后我将dock属性设置为left而不是fill,并将datagridview大小设置为1000,1000。(尽管它默认设置高度) 问题解决了。 我想这个灰色衬里出现是因为尺码问题。也没有出现在每个标签页面......奇怪......但最后我得到了解决方案。

答案 2 :(得分:0)

我知道已经很晚了,但是我遇到了同样的问题,发现将Tabpage的Padding属性设置为3; 3; 3; 3解决了此问题。

答案 3 :(得分:0)

将Tabpage填充更改为3、3、3、3 然后调用DataGrideView1.BringToFront();在表格加载时对我有用。

答案 4 :(得分:0)

如果您要询问灰色区域的大小/布局问题,可以通过将all属性设置为append并将def is_banned(user, ban_group): # use `any` to see if the user matches any of the ban patterns. return any(check_id(user, ban) for ban in ban_group) def all_banned(part, ban_group): # use `all` to see if all of the users matched a ban pattern. return all(is_banned(user, ban_group) for user in part) def solution(user_group, ban_group): # apply the `all_banned` logic to each combination of users of the # specified size. return [ part for part in combinations(user_group, len(ban_group)) if all_banned(part, ban_group) ] 属性设置为VerticalScrollBarsize来解决。

相关问题