简体   繁体   English

Winforms C# DataGridview 上的 VerticalScroll Bar 未显示

[英]Winforms C# VerticalScroll Bar on DataGridview not displayed

My windows form application,I have a gridview on my application and displays all the data required.我的 windows 表单应用程序,我的应用程序上有一个 gridview 并显示所需的所有数据。

Problem is the vertical scrollbar is not visible, but when you scroll your mouse up and down it works.问题是垂直滚动条不可见,但是当您上下滚动鼠标时它可以工作。

Any specific property that I need to check?我需要检查任何特定属性吗?

Please note the scrollbar property's value is already set to BOTH screenshot below:请注意滚动条属性的值已经设置为下面的两个屏幕截图:

财产

the gridview columns are also set / defined manually and not auto generated, autogeneratecolumn is false gridview 列也是手动设置/定义的,不是自动生成的,autogeneratecolumn 是 false

this is my application screenshot below:这是我的应用程序截图如下:

应用

Update, the solution to my problem is remove the filling of gridview on Background Worker.更新,我的问题的解决方案是删除 gridview 在 Background Worker 上的填充。

Since I was using background worker for this operation, tried removing it and the scrollbars also displayed.由于我为此操作使用了后台工作程序,因此尝试将其删除并且还显示了滚动条。

Another thing that I found out when you have background color on column headers by default the scrollbars will not show if datagridview.EnableHeadersVisualStyles = false.当默认情况下列标题上有背景色时,我发现的另一件事是,如果 datagridview.EnableHeadersVisualStyles = false,滚动条将不会显示。

The Work around that I tried and actually works is to set these properties to true:我尝试并实际起作用的解决方法是将这些属性设置为 true:

dataGridView1.Controls 1 .Enabled = true; dataGridView1.Controls 1.Enabled = true; // Index one is the vertical scrollbar dataGridView1.Controls 1 .Visible = true; // 索引一是垂直滚动条 dataGridView1.Controls 1 .Visible = true; // Index one is the vertical scrollbar // 索引一是垂直滚动条

解决方案

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

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