How to find the DataGridViewCell background color in C# - windows application?
如何在C# - windows應用程序中找到DataGridViewCell背景顏色?
Saw this on bytes.com, and another user claims it works, though I have not tested it (this is VB):
在bytes.com上看到這個,另一個用戶聲稱它有效,雖然我沒有測試過它(這是VB):
DataGridView1.Item(ColumnIndex, RowIndex).Style.BackColor = Color
or
DataGridView1.CurrentCell.Style.BackColor = Color
Also see the MSDN documentation:
另請參閱MSDN文檔:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.style.aspx
If you need this information in order to alter the rendering of the cell, you could plug to the Paint or the Formatting event, which EventArgs has a CellStyle property with the background color inside.
如果您需要此信息以更改單元格的渲染,則可以插入Paint或Formatting事件,EventArgs具有內部具有背景顏色的CellStyle屬性。
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2009/04/02/724ffb94a72f50168cd858ca5dd90d36.html。