簡體   English   中英

自動滾動為true時,將垂直滾動條設置到特定位置

[英]Set the vertical scroll bar to a particular position when autoscroll is true

我有一個數據網格,其中有一行藍色。 我想以垂直的藍色滾動條可見的方式放置垂直滾動條的位置。 我的自動滾動屬性設置為true。 因此,每當我嘗試為其設置一些值時,垂直滾動條就會消失。

您可以使用此屬性設置垂直滾動條的位置。

// Search for the row index you want to display using LINQ
var someRowIndex = dgNew.Rows.Cast<DataGridViewRow>()
    .FirstOrDefault(a => a.Cells["SomeColumnName"].Value != null &&
                         a.Cells["SomeColumnName"].Value.ToString() == "Value of some column in the blue row")?.Index;

if (someRowIndex != null)
{
    dg.FirstDisplayedCell = dg.Rows[someRowIndex].Cells[0];
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM