简体   繁体   English

数据网格视图的滚动条可见,但在C#中不起作用

[英]scroll bar of data grid view is visible but not working in c#

When I run my app using visual studio, scroll bar of data grid view is working fine. 当我使用Visual Studio运行应用程序时,数据网格视图的滚动条工作正常。 But when I run same app using executable file, scroll bar is visible but not able to scroll and app is displaying not responding. 但是,当我使用可执行文件运行同一应用程序时,滚动条可见,但无法滚动,并且应用程序显示无响应。 Actually I'm getting data from serial port and adding to the data grid view using data grid view 's invoke function. 实际上,我是从串行端口获取数据并使用数据网格视图的invoke函数添加到数据网格视图中的。

//code snippet //代码段

dgvLog.Invoke((Action)delegate
{
    gvLog.ScrollBars = ScrollBars.None;
    dgvLog.DataSource = bs;
    dgvLog.ScrollBars = ScrollBars.Both;

});

MessageBox.Show("Added to data grid view");

Data is being added to the data grid view but both horizontal and vertical scroll bar is stuck, cannot scroll. 数据正在添加到数据网格视图,但是水平和垂直滚动条都卡住,无法滚动。 It's not showing message box after invoke is finished. 调用完成后未显示消息框。

将数据网格视图属性AutoSizeRowsMo​​de设置AllCells

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

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