簡體   English   中英

C#Winforms DataGridViewLinkColumn動態刪除下划線

[英]C# Winforms DataGridViewLinkColumn remove underline dynamically

我有一個帶有DataGridViewLinkColumn類型的列之一的DataGridView。 我需要根據某些條件從該列下所有行的文本中刪除下划線。 如何在代碼中動態地做到這一點?

請建議我一些解決方法。 謝謝!

試試這個,根據您的情況進行修改...

 foreach (DataGridViewRow row in  dataGridView1.Rows)
 {
      foreach (var cell in row.Cells)
      {
        DataGridViewLinkCell linkCell = cell as DataGridViewLinkCell;
        if(linkCell != null)
        {
          linkCell.LinkBehavior = LinkBehavior.NeverUnderline;
        }
      }
}

暫無
暫無

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

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